This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53524] New: [4.7/4.8 Regression] Bogus and unsupressable enum comparison warning
- From: "ppluzhnikov at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 30 May 2012 01:48:25 +0000
- Subject: [Bug c++/53524] New: [4.7/4.8 Regression] Bogus and unsupressable enum comparison warning
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53524
Bug #: 53524
Summary: [4.7/4.8 Regression] Bogus and unsupressable enum
comparison warning
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ppluzhnikov@google.com
Created attachment 27519
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27519
test case
Test case reduced from llvm/utils/TableGen/AsmMatcherEmitter.cpp
First noticed in gcc-4.7, confirmed in 4.8.0 20120515.
In template metaprogramming, it is quite common to compare enum values from
different instantiations of the same template.
GCC-4.7 started to warn about some of them. Further, the warning doesn't get
suppressed even under -Wno-enum-compare.
There is also a secondary problem: the diagnostic emitted is particularly lousy
-- it points to the enum itself, leaving no clue as to what GCC is complaining
about:
g++ -c tt.cc
tt.cc: In instantiation of âstruct PointerUnionUIntTraits<CodeGenInstruction*,
CodeGenInstAlias*>â:
tt.cc:10:8: required from âstruct
PointerIntPair<PointerUnionUIntTraits<CodeGenInstruction*, CodeGenInstAlias*>
>â
tt.cc:23:9: required from âclass PointerUnion<CodeGenInstruction*,
CodeGenInstAlias*>â
tt.cc:27:61: required from here
tt.cc:14:8: warning: enumeral mismatch in conditional expression:
âPointerLikeTypeTraits<CodeGenInstruction*>::<anonymous enum>â vs
âPointerLikeTypeTraits<CodeGenInstAlias*>::<anonymous enum>â [enabled by
default]
enum {
^