[cfe-commits] r60421 - in /cfe/trunk: lib/Parse/ParseExpr.cpp lib/Parse/ParseExprCXX.cpp test/SemaCXX/new-delete.cpp
Sebastian Redl
sebastian.redl at getdesigned.at
Tue Dec 2 08:57:11 PST 2008
Douglas Gregor wrote:
>
> On Dec 2, 2008, at 8:35 AM, Sebastian Redl wrote:
>
>> + case tok::coloncolon: // [C++] new-expression or [C++]
>> delete-expression
>> + if (NextToken().is(tok::kw_new))
>> + return ParseCXXNewExpression();
>> + else
>> + return ParseCXXDeleteExpression();
>> +
>
> It's worth a comment here noting that '::' followed by anything but
> "new" or "delete" will be resolved to a scope-resolution or qualified
> typename token.
True.
>>
>> + // Don't parse ::new and ::delete as scope specifiers. It would
>> only make
>> + // things a lot more complicated.
>> + if (Tok.is(tok::coloncolon) && (NextToken().is(tok::kw_new) ||
>> + NextToken().is(tok::kw_delete)))
>> + return false;
>
> It's not that parsing ::new and ::delete here would be more
> complicated, it's that they aren't nested-name-specifiers at all, right?
The comment is poorly formulated. I mean to say that the :: of ::new and
::delete shouldn't be turned into a scope annotation token for the
global scope (even though it is a scope identifier, conceptually),
because that would make it more complicated. (I'd later have to verify
that it indeed identifies the global scope and not something else.)
Sebastian
More information about the cfe-commits
mailing list