[PATCH] D16478: Always build a new TypeSourceInfo for function templates with parameters

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 1 13:05:49 PST 2016


rsmith added a comment.

This is a bug -- we intend to reuse `Stmt` nodes across the template and its instantiations, but we should have separate `Decl` nodes in each instantiation (otherwise the `Decl`'s parent will be wrong etc).


================
Comment at: lib/Sema/SemaTemplateInstantiate.cpp:1519-1521
@@ -1518,5 +1518,5 @@
 
   TypeLoc TL = T->getTypeLoc().IgnoreParens();
   if (!TL.getAs<FunctionProtoTypeLoc>())
     return false;
 
----------------
This doesn't look quite right: IIRC, there can be attributes here as well as parens (in particular, calling convention attributes can appear in this position).

================
Comment at: lib/Sema/SemaTemplateInstantiate.cpp:1530
@@ -1528,2 +1529,3 @@
     if (!P) continue;
+    AllParmsNull = false;
 
----------------
Just return true here?


http://reviews.llvm.org/D16478





More information about the cfe-commits mailing list