aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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>;