diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-10-29 20:17:01 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-10-29 20:17:01 +0000 |
commit | f322ed6d39a30f509023cf88588c1e6514226127 (patch) | |
tree | e19645c6b2fa10143bd01464f616e3a1260b5531 /test/SemaTemplate/instantiate-subscript.cpp | |
parent | f9f6196e9fa0c41ae7422f3ebe5515e9d9707087 (diff) |
Properly instantiate usage of overloaded operator []. Fixes PR5345.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85524 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/instantiate-subscript.cpp')
-rw-r--r-- | test/SemaTemplate/instantiate-subscript.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/test/SemaTemplate/instantiate-subscript.cpp b/test/SemaTemplate/instantiate-subscript.cpp index 434d84e2b8..20e2c39d0c 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); +} |