[cfe-commits] [patch] PR10127/N3031 supporting decltype in nested-namespace-specifiers
Douglas Gregor
dgregor at apple.com
Mon Nov 14 08:30:34 PST 2011
On Nov 14, 2011, at 8:10 AM, David Blaikie wrote:
>> Some comments follow…
>
> Thanks for the feedback.
>
>> Index: include/clang/Basic/TokenKinds.def
>> ===================================================================
>> --- include/clang/Basic/TokenKinds.def (revision 143902)
>> +++ include/clang/Basic/TokenKinds.def (working copy)
>> @@ -559,6 +559,8 @@
>> // function template specialization (not a type),
>> // e.g., "std::swap<int>"
>> ANNOTATION(primary_expr) // annotation for a primary expression
>> +ANNOTATION(decltype) // annotation for a decltype expression,
>> + // e.g., "decltype(foo.bar())"
>>
>> // Annotation for #pragma unused(...)
>> // For each argument inside the parentheses the pragma handler will produce
>>
>> Did you consider using annot_typename for this? I ask because annot_typename handles general types (including decltype), and is already well-supported throughout the parser. It looks like you've checked for annot_decltype in several places, but others (such as the tentative parser) would be confused by this annotation token.
>
> No, I hadn't considered that - but at first blush I'd be concerned
> that this might end up being /too/ permissive, but I'll have a go
> mocking it up that way, it'll probably be tidier but I won't be sure
> what other scenarios might be accidentally accepted.
I can reply to the rest later, but just one quick comment here: using annot_typename would likely be too permissive in the parser, but of course Sema can make up for this by directly inspecting (e.g., via "isa") the actual spelling of the type.
- Doug
More information about the cfe-commits
mailing list