https://bugs.llvm.org/show_bug.cgi?id=32913

            Bug ID: 32913
           Summary: Redundant warning when comparing values of different
                    scoped enum types
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: rjmcc...@apple.com
                CC: llvm-bugs@lists.llvm.org

harza:/tmp$ cat red.cpp
enum class UnscopedA { // Also happens if either (but not both) are unscoped
  SomeCase
};

enum class ScopedA {
  SomeOtherCase
};

bool compare(ScopedA a) {
  return (a == UnscopedA::SomeCase);
}

harza:/tmp$ clang++ -std=c++11 -fsyntax-only red.cpp
red.cpp:10:13: warning: comparison of two values with different enumeration
      types ('ScopedA' and 'UnscopedA') [-Wenum-compare]
  return (a == UnscopedA::SomeCase);
          ~ ^  ~~~~~~~~~~~~~~~~~~~
red.cpp:10:13: error: invalid operands to binary expression ('ScopedA' and
      'UnscopedA')
  return (a == UnscopedA::SomeCase);
          ~ ^  ~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.

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

Reply via email to