https://llvm.org/bugs/show_bug.cgi?id=28212
Bug ID: 28212 Summary: No diagnostic for declarations with incompatible enums Product: clang Version: unspecified Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: -New Bugs Assignee: unassignedclangb...@nondot.org Reporter: ch3r...@openwall.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified It seem the declaration (1) makes clang miss incompatibility of types between the declarations (2) and (3). This is a constraints violation: C11, 6.7p4: "All declarations in the same scope that refer to the same object or function shall specify compatible types." Source code: ---------------------------------------------------------------------- unsigned x; // (1) enum { a } x; // (2) enum { b } x; // (3) int main() { } ---------------------------------------------------------------------- Results: ---------------------------------------------------------------------- $ clang -std=c11 -Weverything -O3 test.c && ./a.out test.c:2:12: warning: no previous extern declaration for non-static variable 'x' [-Wmissing-variable-declarations] enum { a } x; ^ 1 warning generated. ---------------------------------------------------------------------- clang version: clang version 3.9.0 (trunk 271312) For comparison: ---------------------------------------------------------------------- $ gcc -std=c11 -pedantic -Wall -Wextra -O3 test.c && ./a.out test.c:3:12: error: conflicting types for ‘x’ enum { b } x; ^ test.c:2:12: note: previous declaration of ‘x’ was here enum { a } x; ^ ---------------------------------------------------------------------- gcc version: gcc (GCC) 7.0.0 20160616 (experimental) -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs