aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/member-template-access-expr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-09-09 00:23:06 +0000
committerDouglas Gregor <dgregor@apple.com>2009-09-09 00:23:06 +0000
commit3b6afbb99a1c44b4076f8e15fb7311405941b306 (patch)
treec1cd15e2e3745e95de9bb6714d84ef1f4000e39d /test/SemaTemplate/member-template-access-expr.cpp
parent7f4f86a2167abc116275e49c81350fc3225485e5 (diff)
Initial stab at implement dependent member references to member
templates, e.g., x.template get<T> We can now parse these, represent them within an UnresolvedMemberExpr expression, then instantiate that expression node in simple cases. This allows us to stumble through parsing LLVM's Casting.h. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81300 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/member-template-access-expr.cpp')
-rw-r--r--test/SemaTemplate/member-template-access-expr.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/SemaTemplate/member-template-access-expr.cpp b/test/SemaTemplate/member-template-access-expr.cpp
new file mode 100644
index 0000000000..20437aee39
--- /dev/null
+++ b/test/SemaTemplate/member-template-access-expr.cpp
@@ -0,0 +1,30 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+template<typename U, typename T>
+U f0(T t) {
+ return t.template get<U>();
+}
+
+template<typename U, typename T>
+int &f1(T t) {
+ // FIXME: When we pretty-print this, we lose the "template" keyword.
+ return t.U::template get<int&>();
+}
+
+struct X {
+ template<typename T> T get();
+};
+
+void test_f0(X x) {
+ int i = f0<int>(x);
+ int &ir = f0<int&>(x);
+}
+
+struct XDerived : public X {
+};
+
+void test_f1(XDerived xd) {
+ // FIXME: Not quite functional yet.
+// int &ir = f1<X>(xd);
+}
+