[Bug c/36941] gcc does not reject invalid cast
egallager at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jul 25 00:49:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36941
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-07-25
CC| |egallager at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #7 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Chris Lattner from comment #0)
> GCC accepts:
> extern struct S x;
> void foo() { (void)x; }
>
> But correctly rejects:
>
> extern struct S x;
> void foo() { x; }
>
Confirmed. Note that clang diagnoses the first one like this:
$ /sw/opt/llvm-3.1/bin/clang-3.1 -c 36941.c
36941.c:2:20: error: incomplete type 'struct S' where a complete type is
required
void foo() { (void)x; }
^
36941.c:1:15: note: forward declaration of 'struct S'
extern struct S x;
^
More information about the Gcc-bugs
mailing list