https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90860

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Mateusz Stępień from comment #0)
> static const int one = 1;
> static const int two = one;
> int main()
> {
>     return two;
> }
> 
> Following code does not compile on gcc 7.4, yet it does on gcc 8.3. I looked
> into the C11 standard and it still does not consider static const variable a
> constant expression, so it should not be allowed to initialize one static
> const with another. Am I missing something? Is it a GNU extension? Clang
> compiles it as well so I'm not sure now.

6.6 p10 "An implementation may accept other forms of constant expressions."

Compilers are allowed (but not required) to accept this.

Reply via email to