On Mon, Aug 4, 2014 at 2:52 PM, Richard Smith <[email protected]> wrote:
> On Mon, Aug 4, 2014 at 11:48 AM, Richard Smith <[email protected]>
> wrote:
>>
>> I don't think the diagnostic wording is right: 'template<typename T>' is
>> not "a template declaration" in itself. A better model for the diagnostic
>> might be this:
>>
>> <stdin>:1:34: error: a typedef cannot be a template
>> template<typename T> typedef int n;
>>                                  ^
>>
>> ... so "a static_assert declaration cannot be a template" (or "[...]
>> cannot be templated" or similar).
>>
>> Also, we should use the same diagnostic for the member-declaration and the
>> non-member-declaration cases. (Right now, the non-member case gives a
>> useless "C++ requires a type specifier" diagnostic.)
>
>
> Alternative approach: only check for tok::kw_static_assert in member
> declarations if we don't have TemplateInfo. Then, when we come to diagnose
> the unexpected static_assert keyword (maybe in ParseDeclarationSpecifiers or
> ParseImplicitInt), produce a custom diagnostic if we're within a template
> declaration.

Good suggestions -- I've committed in r214770. Thanks!

~Aaron
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to