diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-08-21 00:16:32 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-08-21 00:16:32 +0000 |
commit | 6b906869527be40b0d38d755e9ef51b331b88162 (patch) | |
tree | 383418b55d313e27f7e21b20756b8f5347176355 /test/SemaTemplate/member-function-template.cpp | |
parent | c42a92aa1fbd24b7a26c7c29552d07478a8e2045 (diff) | |
download | clang-6b906869527be40b0d38d755e9ef51b331b88162.tar.gz |
Implement support for calling member function templates, which involves:
- Allowing one to name a member function template within a class
template and on the right-hand side of a member access expression.
- Template argument deduction for calls to member function templates.
- Registering specializations of member function templates (and
finding them later).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79581 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/member-function-template.cpp')
-rw-r--r-- | test/SemaTemplate/member-function-template.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/test/SemaTemplate/member-function-template.cpp b/test/SemaTemplate/member-function-template.cpp index 69ebec1365..0f3a37a702 100644 --- a/test/SemaTemplate/member-function-template.cpp +++ b/test/SemaTemplate/member-function-template.cpp @@ -1,5 +1,30 @@ -// RUN: clang-cc -fsyntax-only %s +// RUN: clang-cc -fsyntax-only -verify %s struct X { - template<typename T> T& f(T); + template<typename T> T& f0(T); + + void g0(int i, double d) { + int &ir = f0(i); + double &dr = f0(d); + } + + template<typename T> T& f1(T); + template<typename T, typename U> U& f1(T, U); + + void g1(int i, double d) { + int &ir1 = f1(i); + int &ir2 = f1(d, i); + int &ir3 = f1(i, i); + } }; + +void test_X_f0(X x, int i, float f) { + int &ir = x.f0(i); + float &fr = x.f0(f); +} + +void test_X_f1(X x, int i, float f) { + int &ir1 = x.f1(i); + int &ir2 = x.f1(f, i); + int &ir3 = x.f1(i, i); +}
\ No newline at end of file |