aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-14 23:40:54 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-14 23:40:54 +0000
commite7a18c88b77523cf1085d239fd373770ba5791f1 (patch)
tree74dc51b50881624899e647f0ac757276d016e2b4
parent54dabfca850ca9e60e9ffb60003529f868d4d127 (diff)
Template instantiation for the NULL statement. Lame, I know
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71816 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaTemplateInstantiateExpr.cpp5
-rw-r--r--test/SemaTemplate/instantiate-function-1.cpp11
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateExpr.cpp b/lib/Sema/SemaTemplateInstantiateExpr.cpp
index 6dde788f2e..52daa5d6a0 100644
--- a/lib/Sema/SemaTemplateInstantiateExpr.cpp
+++ b/lib/Sema/SemaTemplateInstantiateExpr.cpp
@@ -441,6 +441,7 @@ namespace {
// FIXME: Once we get closer to completion, replace these
// manually-written declarations with automatically-generated ones
// from clang/AST/StmtNodes.def.
+ OwningStmtResult VisitNullStmt(NullStmt *S);
OwningStmtResult VisitCompoundStmt(CompoundStmt *S);
OwningStmtResult VisitExpr(Expr *E);
@@ -453,6 +454,10 @@ namespace {
};
}
+Sema::OwningStmtResult TemplateStmtInstantiator::VisitNullStmt(NullStmt *S) {
+ return SemaRef.Owned(new (SemaRef.Context) NullStmt(S->getSemiLoc()));
+}
+
Sema::OwningStmtResult
TemplateStmtInstantiator::VisitCompoundStmt(CompoundStmt *S) {
// FIXME: We need an *easy* RAII way to delete these statements if
diff --git a/test/SemaTemplate/instantiate-function-1.cpp b/test/SemaTemplate/instantiate-function-1.cpp
index 61b361f894..9cf2ca5129 100644
--- a/test/SemaTemplate/instantiate-function-1.cpp
+++ b/test/SemaTemplate/instantiate-function-1.cpp
@@ -12,3 +12,14 @@ struct X1 { };
template struct X0<int, float>;
template struct X0<int*, int>;
template struct X0<int X1::*, int>; // expected-note{{instantiation of}}
+
+template<typename T>
+struct X2 {
+ void f(T);
+
+ T g(T x, T y) {
+ /* NullStmt */;
+ }
+};
+
+template struct X2<int>;