On Mon, Nov 29, 2010 at 3:24 PM, Roman Kononov <ro...@xtremedata.com> wrote: > $ cat test.cc > struct X { static float const v=1; }; > > $ g++ -c -std=gnu++0x test.cc > test.cc:1:33: error: 'constexpr' needed for in-class initialization of > static data member 'v' of non-integral type > > This will break a great deal of existing c++ code preventing easy > transition to c++0x. Maybe, the constexpr requirement should be relaxed > in gnu++0x mode. > > Please see the trivial patch.
I believe you may be confused. Your program does not use `constexpr' at all, so I think your $SUBJECT and prognosis is not right. The above code is invalid C++03 code. It stays invalid in C++0x. However, if you do want to write something like that in C++0x, you do have to use `constexpr' -- that is what the diagnostic message is saying. Summary: this is a non-issue. -- Gaby