This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/9927: Compiler requires definition of static member constants
- From: Andrew Bell <acbell at iastate dot edu>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 3 Mar 2003 22:26:00 -0000
- Subject: Re: c++/9927: Compiler requires definition of static member constants
- Reply-to: Andrew Bell <acbell at iastate dot edu>
The following reply was made to PR c++/9927; it has been noted by GNATS.
From: Andrew Bell <acbell at iastate dot edu>
To: bangerth at dealii dot org, acbell at iastate dot edu, gcc-bugs at gcc dot gnu dot org,
gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Cc:
Subject: Re: c++/9927: Compiler requires definition of static member
constants
Date: Mon, 03 Mar 2003 16:21:50 -0600
At 10:01 PM 3/3/2003 +0000, you wrote:
>Old Synopsis: Compiler doesn't inline static const int's used in ?:
>New Synopsis: Compiler requires definition of static member constants
>
>State-Changed-From-To: open->closed
>State-Changed-By: bangerth
>State-Changed-When: Mon Mar 3 22:01:45 2003
>State-Changed-Why:
> The compiler is allowed to require that you provide a
> definition of static member constants. I think, they are
> even mandated. That's exactly what happens in your case.
>
> You'll notice, however, that if you compile with optimization,
> the compiler actually replaces references to these
> variables by their values, which is probably what you
> want.
Why, then, does the program compile and link if the "?:" construct is
replaced with a "if (...) else (...)", even if the static const int's are
not defined. I thought this was a special case for const int's.
-- Andrew Bell
acbell at iastate dot edu