This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/8778: ICE on illegal initialization of non-integral static in-class constant


Dear Wolfgang,

I still don't agree with you ;-)

On  2 Dec, Wolfgang Bangerth wrote:

>> Initializing const arrays is usually supported by gcc.
> 
> True, but not as static member variables.

You can really compile the following with gcc!!!

------------------------snip here----------------------
template <int n> struct A
{
    static const int i[] = { 1, 2 };       // works
};

------------------------snip here----------------------

Only with -pedantic you'll get a warning:

test.cc:3: warning: ISO C++ forbids initialization of member constant `i'
of non-integral type `const int[]'

>> In fact, the code compiles if you just leave out the curly
>> braces around the initializer.

That refers to the original testcase. Just try it!

Best regards,
Volker



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]