================
Comment at: test/CXX/temp/temp.decls/temp.variadic/sizeofpack.cpp:4
@@ +3,3 @@
+
+// PR12262
+
----------------
This bug now has a rather large pile of duplicates. Can you check whether this 
change fixes them all, and maybe extract some more testcases from them?

================
Comment at: lib/Sema/SemaTemplateDeduction.cpp:3155
@@ +3154,3 @@
+       Param != ParamEnd; ++Param) {
+    if (TemplateTypeParmDecl *D = dyn_cast<TemplateTypeParmDecl>(*Param)) {
+      if (D->isParameterPack()) {
----------------
It seems to me that this should also be necessary for non-type template 
parameters and for template template parameters.

================
Comment at: lib/Sema/SemaTemplateDeduction.cpp:3157-3161
@@ +3156,7 @@
+      if (D->isParameterPack()) {
+        TemplateTypeParmDecl *Inst = D->Clone(Context, 0, 0);
+        Inst->setAccess(AS_public);
+        // Introduce this template parameter's instantiation into the
+        // instantiation scope.
+        CurrentInstantiationScope->InstantiatedLocal(D, Inst);
+      }
----------------
Can you use SubstDecl here instead? I think you'll need something more general 
than this for cases such as:

    template<typename T, T ...> struct seq {};
    template<typename T, T ...U> seq<int, sizeof...(U)> f(seq<T, U...>); 
    auto x = f<int>(seq<int, 1, 2, 3>());

================
Comment at: lib/Sema/SemaTemplateDeduction.cpp:3157
@@ +3156,3 @@
+      if (D->isParameterPack()) {
+        TemplateTypeParmDecl *Inst = D->Clone(Context, 0, 0);
+        Inst->setAccess(AS_public);
----------------
Richard Smith wrote:
> Can you use SubstDecl here instead? I think you'll need something more 
> general than this for cases such as:
> 
>     template<typename T, T ...> struct seq {};
>     template<typename T, T ...U> seq<int, sizeof...(U)> f(seq<T, U...>); 
>     auto x = f<int>(seq<int, 1, 2, 3>());
Do you really need a clone here, or can you just say that the template 
parameter maps to itself?


http://llvm-reviews.chandlerc.com/D869
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to