This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/67580] New: Improve error message on missing "struct" tag


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.
$:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]