summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-03-31 00:43:58 +0000
committerDouglas Gregor <dgregor@apple.com>2009-03-31 00:43:58 +0000
commitb67535d1b6d7fed3388fd01084e4a3f624cf4e2a (patch)
tree154ad36e01bd53e6e204ebd9a576f92db97764ba /clang/test
parentb874bd9f4198c54b5bb974929dd813e3cc85d2a2 (diff)
downloadbcm5719-llvm-b67535d1b6d7fed3388fd01084e4a3f624cf4e2a.tar.gz
bcm5719-llvm-b67535d1b6d7fed3388fd01084e4a3f624cf4e2a.zip
Parsing and AST representation for dependent template names that occur
within nested-name-specifiers, e.g., for the "apply" in typename MetaFun::template apply<T1, T2>::type At present, we can't instantiate these nested-name-specifiers, so our testing is sketchy. llvm-svn: 68081
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaTemplate/metafun-apply.cpp29
-rw-r--r--clang/test/SemaTemplate/nested-name-spec-template.cpp13
2 files changed, 42 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/metafun-apply.cpp b/clang/test/SemaTemplate/metafun-apply.cpp
new file mode 100644
index 00000000000..22be5ab34f7
--- /dev/null
+++ b/clang/test/SemaTemplate/metafun-apply.cpp
@@ -0,0 +1,29 @@
+// RUN: clang-cc -fsyntax-only %s
+
+struct add_pointer {
+ template<typename T>
+ struct apply {
+ typedef T* type;
+ };
+};
+
+struct add_reference {
+ template<typename T>
+ struct apply {
+ typedef T& type;
+ };
+};
+
+template<typename MetaFun, typename T>
+struct apply1 {
+ typedef typename MetaFun::template apply<T>::type type;
+};
+
+#if 0
+// FIXME: The code below requires template instantiation for dependent
+// template-names that occur within nested-name-specifiers.
+int i;
+
+apply1<add_pointer, int>::type ip = &i;
+apply1<add_reference, int>::type ir = i;
+#endif
diff --git a/clang/test/SemaTemplate/nested-name-spec-template.cpp b/clang/test/SemaTemplate/nested-name-spec-template.cpp
index f856268d6ee..6df2ca6a918 100644
--- a/clang/test/SemaTemplate/nested-name-spec-template.cpp
+++ b/clang/test/SemaTemplate/nested-name-spec-template.cpp
@@ -42,8 +42,21 @@ namespace N {
struct A<int> {
struct X;
};
+
+ struct B;
}
struct ::N::A<int>::X {
int foo;
};
+
+#if 0
+// FIXME: the following crashes the parser, because Sema has no way to
+// community that the "dependent" template-name N::template B doesn't
+// actually refer to a template.
+template<typename T>
+struct TestA {
+ typedef typename N::template B<T>::type type; // xpected-error{{'B' following the 'template' keyword does not refer to a template}}
+ // FIXME: should show what B *does* refer to.
+};
+#endif
OpenPOWER on IntegriCloud