summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/overloaded-operator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/overloaded-operator.cpp')
-rw-r--r--test/SemaCXX/overloaded-operator.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp
index 8ecb54d..e5b3fab 100644
--- a/test/SemaCXX/overloaded-operator.cpp
+++ b/test/SemaCXX/overloaded-operator.cpp
@@ -415,3 +415,28 @@ namespace PR11784 {
void f(int);
void g() { A x; x = f; }
}
+
+namespace test10 {
+ struct A {
+ void operator[](float (*fn)(int)); // expected-note 2 {{not viable: no overload of 'bar' matching 'float (*)(int)'}}
+ };
+
+ float foo(int);
+ float foo(float);
+
+ template <class T> T bar(T);
+ template <class T, class U> T bar(U);
+
+ void test(A &a) {
+ a[&foo];
+ a[foo];
+
+ a[&bar<int>]; // expected-error {{no viable overloaded operator[]}}
+ a[bar<int>]; // expected-error {{no viable overloaded operator[]}}
+
+ // If these fail, it's because we're not letting the overload
+ // resolution for operator| resolve the overload of 'bar'.
+ a[&bar<float>];
+ a[bar<float>];
+ }
+}
OpenPOWER on IntegriCloud