This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/8778: ICE on illegal initialization of non-integral staticin-class constant
- From: Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 3 Dec 2002 14:56:05 -0000
- Subject: Re: c++/8778: ICE on illegal initialization of non-integral staticin-class constant
- Reply-to: Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
The following reply was made to PR c++/8778; it has been noted by GNATS.
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
Cc: gcc-gnats@gcc.gnu.org, <gcc-bugs@gcc.gnu.org>, <sgunderson@bigfoot.com>
Subject: Re: c++/8778: ICE on illegal initialization of non-integral static
in-class constant
Date: Tue, 3 Dec 2002 08:53:54 -0600 (CST)
Hi Volker,
> I still don't agree with you ;-)
Still not? I'm not arguing hard enough...
> You can really compile the following with gcc!!!
>
> ------------------------snip here----------------------
> template <int n> struct A
> {
> static const int i[] = { 1, 2 }; // works
> };
>
> ------------------------snip here----------------------
I never doubted that you can compile it, but that does not make it legal.
> 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[]'
So maybe we can meet in the middle: "The code is illegal based on the C++
standard, but is accepted as a gcc extension"?
The point is moot anyway, since we certainly agree that an ICE is not an
appropriate behavior, the code being legal or not.
Cheers :-)
Wolfgang
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ticam.utexas.edu
www: http://www.ticam.utexas.edu/~bangerth