summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/overloaded-operator.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-02-17 08:37:06 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-02-17 08:37:06 +0000
commit712563bba42c69f924739768832d1a23c71c95d5 (patch)
treeb8417c78f265b955bc13b2d23882ea56717efd72 /clang/test/SemaCXX/overloaded-operator.cpp
parent491eb276a744025d04d01877df722aebb823f177 (diff)
downloadbcm5719-llvm-712563bba42c69f924739768832d1a23c71c95d5.tar.gz
bcm5719-llvm-712563bba42c69f924739768832d1a23c71c95d5.zip
Implement -Wenum-compare, which warns when comparing two enums of
different types. We omit the warning when the enum types are anonymous. Unlike GCC, this warning does not distinguish between C++ and C/ObjC for controling whether it is on by default, it is always on by default. Original patch contributed by Richard Trieu (@ Google), I fixed some style issues, and cleaned it up for submission. llvm-svn: 125739
Diffstat (limited to 'clang/test/SemaCXX/overloaded-operator.cpp')
-rw-r--r--clang/test/SemaCXX/overloaded-operator.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/overloaded-operator.cpp b/clang/test/SemaCXX/overloaded-operator.cpp
index a9d3f128e2b..4399a026eaf 100644
--- a/clang/test/SemaCXX/overloaded-operator.cpp
+++ b/clang/test/SemaCXX/overloaded-operator.cpp
@@ -70,11 +70,11 @@ struct E2 {
// C++ [over.match.oper]p3 - enum restriction.
float& operator==(E1, E2);
-void enum_test(Enum1 enum1, Enum2 enum2, E1 e1, E2 e2) {
+void enum_test(Enum1 enum1, Enum2 enum2, E1 e1, E2 e2, Enum1 next_enum1) {
float &f1 = (e1 == e2);
float &f2 = (enum1 == e2);
float &f3 = (e1 == enum2);
- float &f4 = (enum1 == enum2); // expected-error{{non-const lvalue reference to type 'float' cannot bind to a temporary of type 'bool'}}
+ float &f4 = (enum1 == next_enum1); // expected-error{{non-const lvalue reference to type 'float' cannot bind to a temporary of type 'bool'}}
}
// PR5244 - Argument-dependent lookup would include the two operators below,
OpenPOWER on IntegriCloud