From e7a18c88b77523cf1085d239fd373770ba5791f1 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 14 May 2009 23:40:54 +0000 Subject: [PATCH] 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 --- lib/Sema/SemaTemplateInstantiateExpr.cpp | 5 +++++ test/SemaTemplate/instantiate-function-1.cpp | 11 +++++++++++ 2 files changed, 16 insertions(+) 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; template struct X0; template struct X0; // expected-note{{instantiation of}} + +template +struct X2 { + void f(T); + + T g(T x, T y) { + /* NullStmt */; + } +}; + +template struct X2; -- 2.50.1