aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/instantiate-typedef.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-03-11 16:48:53 +0000
committerDouglas Gregor <dgregor@apple.com>2009-03-11 16:48:53 +0000
commit4fdf1faedbca40787fd277a6fbd5061fd69b2708 (patch)
tree008da53407dbd3facf3ffa4d9c8b1558b2617228 /test/SemaTemplate/instantiate-typedef.cpp
parent511d7aba3b12853fdb88729a0313b80a60eab8ad (diff)
Add basic, hackish support for instantiation of typedefs in a class
template. More importantly, start to sort out the issues regarding complete types and nested-name-specifiers, especially the question of: when do we instantiate a class template specialization that occurs to the left of a '::' in a nested-name-specifier? git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66662 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/instantiate-typedef.cpp')
-rw-r--r--test/SemaTemplate/instantiate-typedef.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-typedef.cpp b/test/SemaTemplate/instantiate-typedef.cpp
new file mode 100644
index 0000000000..8ecee50502
--- /dev/null
+++ b/test/SemaTemplate/instantiate-typedef.cpp
@@ -0,0 +1,15 @@
+// RUN: clang -fsyntax-only -verify %s
+
+template<typename T>
+struct add_pointer {
+ typedef T* type; // expected-error{{'type' declared as a pointer to a reference}}
+};
+
+add_pointer<int>::type test1(int * ptr) { return ptr; }
+
+add_pointer<float>::type test2(int * ptr) {
+ return ptr; // expected-error{{incompatible type returning 'int *', expected 'type' (aka 'float *')}}
+}
+
+add_pointer<int&>::type // expected-note{{in instantiation of template class 'struct add_pointer<int &>' requested here}}
+test3(); // FIXME: expected-error{{invalid token after top level declarator}}