This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] [PR13810] ICE on default argument for template template parameter (3.4/3.5 regression)


Gabriel Dos Reis wrote:

>> !    /* Try to emit a slightly smarter error message if we detect
>> !       that the user is using a template instantiation.  */
>> !    if (CLASSTYPE_TEMPLATE_INFO (t)
>> !        && CLASSTYPE_TEMPLATE_INSTANTIATION (t))
>> !      error ("`%D' is a template instantiation and cannot be used
>> as a " !      "default argument for a template template parameter",
>
> consider:
>
>          error ("invalid use of type '%T' used as default value "
>                 "for a template template-parameter",
>
> Please, notice the use of '%T' instead of '%D'.

Out of curiosity, what's the rationale on using %T rather than %D in this
specific case (when it's a template instantiation)?. Did you specifically
exclude from the diagnostic the part about it being a template instantiation?
My original idea about detecting a TYPE_DECL which is a template instantiation
was to be able to emit something like:

error: invalid use of type 'a<0>' as a default value for a template
template-parameter
note: 'a<0>' is a template instantiation, did you mean 'a' instead?

but I couldn't quite get 'a' out of 'a<0>'.

Giovanni Bajo



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]