This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/8778: ICE on illegal initialization of non-integral static in-class constant
- From: Volker Reichelt <reichelt at igpm dot rwth-aachen dot de>
- To: bangerth at ticam dot utexas dot edu
- Cc: gcc-gnats at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, sgunderson at bigfoot dot com
- Date: Tue, 3 Dec 2002 02:28:07 +0100
- Subject: 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