aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/instantiate-subscript.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2009-11-04 15:04:32 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2009-11-04 15:04:32 +0000
commit51fb8b013e7734b795139f49d3b1f77c539be20a (patch)
tree59e0e47a9831dcf0e21e547927c8ebb7e113bfd1 /test/SemaTemplate/instantiate-subscript.cpp
parent73490b890977362d28dd6326843a1ecae413921d (diff)
Diffstat (limited to 'test/SemaTemplate/instantiate-subscript.cpp')
-rw-r--r--test/SemaTemplate/instantiate-subscript.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/test/SemaTemplate/instantiate-subscript.cpp b/test/SemaTemplate/instantiate-subscript.cpp
index 434d84e2b893..20e2c39d0cce 100644
--- a/test/SemaTemplate/instantiate-subscript.cpp
+++ b/test/SemaTemplate/instantiate-subscript.cpp
@@ -6,7 +6,7 @@ struct Sub0 {
};
struct Sub1 {
- long &operator[](long);
+ long &operator[](long); // expected-note{{candidate function}}
};
struct ConvertibleToInt {
@@ -24,3 +24,18 @@ template struct Subscript0<int*, int, int&>;
template struct Subscript0<Sub0, int, int&>;
template struct Subscript0<Sub1, ConvertibleToInt, long&>;
template struct Subscript0<Sub1, Sub0, long&>; // expected-note{{instantiation}}
+
+// PR5345
+template <typename T>
+struct S {
+ bool operator[](int n) const { return true; }
+};
+
+template <typename T>
+void Foo(const S<int>& s, T x) {
+ if (s[0]) {}
+}
+
+void Bar() {
+ Foo(S<int>(), 0);
+}