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

            Bug ID: 88442
           Summary: Misleading error message with duplicated struct
                    definitions
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: a...@linux-foundation.org
  Target Milestone: ---

q:/home/akpm> cat t.c
struct foo;

struct foo { int a; };

struct foo { int a, b; };

q:/home/akpm> gcc -c t.c
t.c:5:8: error: redefinition of 'struct foo'
 struct foo { int a, b; };
        ^~~
t.c:1:8: note: originally defined here
 struct foo;


It's arguably misleading and certainly unuseful to say that struct foo was
originally defined at line 1.  You sit there scratching your head looking at
line 1 wondering why it didn't compile. It would be more useful to point the
user at line 3!

Reply via email to