diff options
Diffstat (limited to 'test/SemaCXX/overloaded-operator.cpp')
-rw-r--r-- | test/SemaCXX/overloaded-operator.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp index 10b0f5a76804..0f723ad206b9 100644 --- a/test/SemaCXX/overloaded-operator.cpp +++ b/test/SemaCXX/overloaded-operator.cpp @@ -70,6 +70,34 @@ void enum_test(Enum1 enum1, Enum2 enum2, E1 e1, E2 e2) { float &f4 = (enum1 == enum2); // expected-error{{non-const lvalue reference to type 'float' cannot be initialized with a temporary of type 'bool'}} } +// PR5244 - Argument-dependent lookup would include the two operators below, +// which would break later assumptions and lead to a crash. +class pr5244_foo +{ + pr5244_foo(int); + pr5244_foo(char); +}; + +bool operator==(const pr5244_foo& s1, const pr5244_foo& s2); +bool operator==(char c, const pr5244_foo& s); + +enum pr5244_bar +{ + pr5244_BAR +}; + +class pr5244_baz +{ + pr5244_bar quux; +}; + +void pr5244_barbaz() +{ + pr5244_baz quuux; + (void)(pr5244_BAR == quuux.quux); +} + + struct PostInc { PostInc operator++(int); |