Hans Petter Selasky <h...@selasky.org> writes:

> On 02/17/18 01:42, Jan Beich wrote:
>
>> To generate errors instead ?
>
> Which compiler are you using?
>
> This was tested with clang over here.

$ cc -v
FreeBSD clang version 6.0.0 (branches/release_60 324090) (based on LLVM 6.0.0)
Target: x86_64-unknown-freebsd12.0
Thread model: posix
InstalledDir: /usr/bin

$ cat a.c
union {
  char  i8[];
  short i16[];
  int   i32[];
  long  i64[];
} foo;

$ cc -c a.c
a.c:2:9: error: flexible array member 'i8' in a union is not allowed
  char  i8[];
        ^
a.c:3:9: error: flexible array member 'i16' in a union is not allowed
  short i16[];
        ^
a.c:4:9: error: flexible array member 'i32' in a union is not allowed
  int   i32[];
        ^
a.c:5:9: error: flexible array member 'i64' in a union is not allowed
  long  i64[];
        ^
4 errors generated.

$ gcc7 -c a.c
a.c:2:9: error: flexible array member in union
   char  i8[];
         ^~
a.c:3:9: error: flexible array member in union
   short i16[];
         ^~~
a.c:4:9: error: flexible array member in union
   int   i32[];
         ^~~
a.c:5:9: error: flexible array member in union
   long  i64[];
         ^~~
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to