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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-11-28
     Ever confirmed|0                           |1

--- Comment #4 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #1)
> gcc now produces at least 1 error in c++ mode:
> 
> $ /usr/local/bin/gcc -c -S -Wall -Wextra -Wpedantic -xc 72754.cc
> 72754.cc:1:14: error: flexible array member in a struct with no named members
>  struct { int a[]; } *p;
>               ^
> 72754.cc:4:15: error: flexible array member in a struct with no named members
>   struct { int a[]; } *q;
>                ^
> $ /usr/local/bin/g++ -c -S -Wall -Wextra -Wpedantic -xc++ 72754.cc
> 72754.cc:1:16: warning: ISO C++ forbids flexible array member ‘a’
> [-Wpedantic]
>  struct { int a[]; } *p;
>                 ^
> 72754.cc:4:17: warning: ISO C++ forbids flexible array member ‘a’
> [-Wpedantic]
>   struct { int a[]; } *q;
>                  ^
> 72754.cc:4:17: error: flexible array member ‘S::<unnamed struct>::a’ in an
> otherwise empty ‘struct S’
> 72754.cc:1:22: warning: ‘p’ defined but not used [-Wunused-variable]
>  struct { int a[]; } *p;
>                       ^
> $ /sw/opt/llvm-3.1/bin/clang++ -c -S -Wall -Wextra -pedantic -xc++ 72754.cc
> 72754.cc:1:14: warning: flexible array member 'a' in otherwise empty struct
> is a GNU extension [-pedantic,-Wgnu]
> struct { int a[]; } *p;
>              ^
> 72754.cc:4:15: warning: flexible array member 'a' in otherwise empty struct
> is a GNU extension [-pedantic,-Wgnu]
>         struct { int a[]; } *q;
>                      ^
> 72754.cc:1:22: warning: unused variable 'p' [-Wunused-variable]
> struct { int a[]; } *p;
>                      ^
> 3 warnings generated.
> $ 
> 

Let me update the comparison output for clang to a newer version of it (6):

$ clang++ -c -S -Wall -Wextra -pedantic -xc++ 72754.cc
72754.cc:1:14: warning: flexible array member 'a' in otherwise empty struct is
a GNU extension [-Wgnu-empty-struct]
struct { int a[]; } *p;
             ^
72754.cc:1:14: warning: flexible array members are a C99 feature
[-Wc99-extensions]
72754.cc:4:15: warning: flexible array member 'a' in otherwise empty struct is
a GNU extension [-Wgnu-empty-struct]
        struct { int a[]; } *q;
                     ^
72754.cc:4:15: warning: flexible array members are a C99 feature
[-Wc99-extensions]
72754.cc:1:22: warning: unused variable 'p' [-Wunused-variable]
struct { int a[]; } *p;
                     ^
5 warnings generated.
$

(In reply to Martin Sebor from comment #2)
> The second case has been diagnosed since r241143 (bug 71912) but the first
> one is still accepted.

Guess I should mark this as confirmed then.

Reply via email to