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++/53524] New: [4.7/4.8 Regression] Bogus and unsupressable enum comparison warning


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 {
        ^


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