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

            Bug ID: 79983
           Summary: Improve enum and struct redefinition diagnostic
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

As discussed here <https://gcc.gnu.org/ml/gcc-patches/2017-03/msg00438.html>
we should do better enum/struct redefinition.

Here

enum E;
enum E { A, B, C };
enum E { D, F };

and here

struct S;
struct S { int i; };
struct S { int i, j; };

gcc gives suboptimal

ll.c:3:8: error: redefinition of ‘struct S’
 struct S { int i, j; };
        ^
ll.c:1:8: note: originally defined here
 struct S;
        ^

while clang gets it right:
ll.c:3:8: error: redefinition of 'S'
struct S { int i, j; };
       ^
ll.c:2:8: note: previous definition is here
struct S { int i; };
       ^

Reply via email to