summaryrefslogtreecommitdiff
path: root/test/SemaTemplate/instantiate-expr-4.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-21 18:34:44 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-21 18:34:44 +0000
commit12d0c307369e4a523e2e40025bf124c310f98dff (patch)
tree83c1b725157a8dbbe100855e2d06b9a46250c0a1 /test/SemaTemplate/instantiate-expr-4.cpp
parent42e5b50f4dc897f252e0d476063a7f9846d96624 (diff)
downloadclang-12d0c307369e4a523e2e40025bf124c310f98dff.tar.gz
Template instantiation for C++ "typeid" expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72218 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/instantiate-expr-4.cpp')
-rw-r--r--test/SemaTemplate/instantiate-expr-4.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-expr-4.cpp b/test/SemaTemplate/instantiate-expr-4.cpp
index 6ef0f83add..1511c7aaf8 100644
--- a/test/SemaTemplate/instantiate-expr-4.cpp
+++ b/test/SemaTemplate/instantiate-expr-4.cpp
@@ -113,3 +113,29 @@ template struct Throw1<int>;
template struct Throw1<int*>;
template struct Throw1<Incomplete*>; // expected-note{{instantiation}}
+// ---------------------------------------------------------------------
+// typeid expressions
+// ---------------------------------------------------------------------
+
+// FIXME: This should really include <typeinfo>, but we don't have that yet.
+namespace std {
+ class type_info;
+}
+
+template<typename T>
+struct TypeId0 {
+ const std::type_info &f(T* ptr) {
+ if (ptr)
+ return typeid(ptr);
+ else
+ return typeid(T);
+ }
+};
+
+struct Abstract {
+ virtual void f() = 0;
+};
+
+template struct TypeId0<int>;
+template struct TypeId0<Incomplete>;
+template struct TypeId0<Abstract>;