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/71597] New: Confusing warning for incompatible enums


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).

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