Message ID | 52582CB8.7030008@oracle.com |
---|---|
State | New |
Headers | show |
How does a TEMPLATE_PARM_INDEX get this far? It should have been detected as dependent before this. Jason
Hi, On 10/11/2013 07:46 PM, Jason Merrill wrote: > How does a TEMPLATE_PARM_INDEX get this far? It should have been > detected as dependent before this. Thanks. Interesting. We get there from the convert_nontype_argument call at line 6453 of pt.c (in convert_template_argument) , which is protected by: else if (!dependent_template_arg_p (orig_arg) && !uses_template_parms (t)) thus dependent_template_arg_p (orig_arg) returns *false* for that tree. This is trivially the case because dependent_template_arg_p begins: if (!processing_template_decl) return false; thus it doesn't go that far when processing_template_decl is 0. Otherwise it would return true. Is this information already useful to you? Are we maybe failing to bump processing_template_decl somewhere while processing the specialization? Thanks! Paolo.
Index: cp/semantics.c =================================================================== --- cp/semantics.c (revision 203449) +++ cp/semantics.c (working copy) @@ -9335,6 +9335,7 @@ cxx_eval_constant_expression (const constexpr_call case FUNCTION_DECL: case TEMPLATE_DECL: case LABEL_DECL: + case TEMPLATE_PARM_INDEX: return t; case PARM_DECL: Index: testsuite/g++.dg/cpp0x/variadic145.C =================================================================== --- testsuite/g++.dg/cpp0x/variadic145.C (revision 0) +++ testsuite/g++.dg/cpp0x/variadic145.C (working copy) @@ -0,0 +1,10 @@ +// PR c++/58466 +// { dg-do compile { target c++11 } } + +template<char, char...> struct A; + +template<typename> struct B; + +template<char... C> struct B<A<C...>> {}; + +B<A<'X'>> b; // { dg-error "incomplete type" }