summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/instantiate-expr-4.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-22 21:26:58 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-22 21:26:58 +0000
commitefe7c393e128b37baa78738fc114fea90706419c (patch)
treeacb8e5d2277df821d553018db4af0a9502467bb8 /clang/test/SemaTemplate/instantiate-expr-4.cpp
parenta8db954f241b340b9ce1466ea3c4a17969573af5 (diff)
downloadbcm5719-llvm-efe7c393e128b37baa78738fc114fea90706419c.tar.gz
bcm5719-llvm-efe7c393e128b37baa78738fc114fea90706419c.zip
Add a few tests to ensure that member functions of class templates can
call other member functions of class templates, including after template instantiation. No functionality change. llvm-svn: 72282
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-expr-4.cpp')
-rw-r--r--clang/test/SemaTemplate/instantiate-expr-4.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-expr-4.cpp b/clang/test/SemaTemplate/instantiate-expr-4.cpp
index 0f2bb93f413..d23d01bf3bb 100644
--- a/clang/test/SemaTemplate/instantiate-expr-4.cpp
+++ b/clang/test/SemaTemplate/instantiate-expr-4.cpp
@@ -238,3 +238,41 @@ struct NonDepMemberExpr0 {
};
template struct NonDepMemberExpr0<0>;
+
+template<typename T, typename Result>
+struct MemberFuncCall0 {
+ void f(T t) {
+ Result result = t.f();
+ }
+};
+
+template<typename T>
+struct HasMemFunc0 {
+ T f();
+};
+
+
+template struct MemberFuncCall0<HasMemFunc0<int&>, const int&>;
+
+template<typename Result>
+struct ThisMemberFuncCall0 {
+ Result g();
+
+ void f() {
+ Result r1 = g();
+ Result r2 = this->g();
+ }
+};
+
+template struct ThisMemberFuncCall0<int&>;
+
+template<typename T>
+struct NonDepMemberCall0 {
+ void foo(HasMemFunc0<int&> x) {
+ T result = x.f(); // expected-error{{initialized}}
+ }
+};
+
+template struct NonDepMemberCall0<int&>;
+template struct NonDepMemberCall0<const int&>;
+template struct NonDepMemberCall0<float&>; // expected-note{{instantiation}}
OpenPOWER on IntegriCloud