]> granicus.if.org Git - clang/commitdiff
Template instantiation for the NULL statement. Lame, I know
authorDouglas Gregor <dgregor@apple.com>
Thu, 14 May 2009 23:40:54 +0000 (23:40 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 14 May 2009 23:40:54 +0000 (23:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71816 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplateInstantiateExpr.cpp
test/SemaTemplate/instantiate-function-1.cpp

index 6dde788f2e2a8294c1dfd04d2d1623daf26d114d..52daa5d6a0313c2496f71e134045c23c587816e8 100644 (file)
@@ -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
index 61b361f894af5be24dfe7bde50f704fd1d76952e..9cf2ca5129e30ab2f12ac3606289ea967b3c88ff 100644 (file)
@@ -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>;