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

            Bug ID: 71597
           Summary: Confusing warning for incompatible enums
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ch3root at openwall dot com
  Target Milestone: ---

Source code:

----------------------------------------------------------------------
enum { a } x; // (1)
unsigned x; // (2)
enum { b } x; // (3)

int main()
{
}
----------------------------------------------------------------------

Results:

----------------------------------------------------------------------
$ gcc -std=c11 -pedantic -Wall -Wextra -O3 test.c && ./a.out
test.c:3:12: error: conflicting types for ‘x’
 enum { b } x; // (3)
            ^
test.c:2:10: note: previous declaration of ‘x’ was here
 unsigned x; // (2)
          ^
----------------------------------------------------------------------

gcc version: gcc (GCC) 7.0.0 20160616 (experimental)

It would be better to display the conflicting declaration (1) instead of just
the previous one (2).

Reply via email to