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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So this `( X0 && ) { } ` is a compound-literal which is invalid in C++ in the
first place so this is an extension.
GCC basically does this like `(X0 &&) X0{ }` which is in more tune like C99
compound-literal (though it is a temporary).

GCC rejects the original testcase with -pedantic-errors:
```
<source>:1:32: error: ISO C++ forbids compound-literals [-Wpedantic]
    1 | struct X0 { } X1 = ( X0 && ) { } ;
      |                                ^
```


Note this is accepted by both compilers:
```
struct X0 { } X1 = ( X0 && ) X0{ } ;
```

Basically the extension is implemented slightly different by both compilers
that is fine since it is an extension to the language.

Reply via email to