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

            Bug ID: 67580
           Summary: Improve error message on missing "struct" tag
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com
  Target Milestone: ---

I wonder whether the error message on missing the 'struct' tag can be improved.
IMHO, clang gives a clearer message on how to fix the error. This also applies
to union types.  

$: cat t.c
struct S {int s;};

void f(int a) {
  S s = {a};
}
$: gcc-trunk -c t.c
t.c: In function ā€˜f’:
t.c:4:3: error: unknown type name ā€˜S’
   S s = {a};
   ^
$: clang-trunk -c t.c
t.c:4:3: error: must use 'struct' tag to refer to type 'S'
  S s = {a};
  ^
  struct 
1 error generated.
$:

Reply via email to