[cfe-commits] r65570 - in /cfe/trunk: include/clang/Analysis/ include/clang/Basic/ include/clang/Driver/ include/clang/Parse/ lib/Analysis/ lib/Basic/ lib/Driver/ lib/Parse/ lib/Rewrite/ lib/Sema/ test/Parser/ test/SemaTemplate/
Chris Lattner
clattner at apple.com
Fri Feb 27 11:24:45 PST 2009
On Feb 27, 2009, at 9:50 AM, Douglas Gregor wrote:
>>>
>>> +++ cfe/trunk/lib/Parse/ParseExpr.cpp Thu Feb 26 15:00:50 2009
>>> @@ -365,10 +365,19 @@
>>>
>>> if (!LHS.isInvalid()) {
>>> // Combine the LHS and RHS into the LHS (e.g. build AST).
>>> - if (TernaryMiddle.isInvalid())
>>> + if (TernaryMiddle.isInvalid()) {
>>> + // If we're using '>>' as an operator within a template
>>> + // argument list (in C++98), suggest the addition of
>>> + // parentheses so that the code remains well-formed in C+
>>> +0x.
>>
>> It seems somewhat strange to me to handle this diag here instead of
>> sema. Are you sure it wouldn't be more elegant in sema?
>
> Yes, because it's a parsing issue, not a semantic issue. The '>>'
> token is treated differently in a template argument list in C++98
> vs. C++0x, and the parser encodes this behavior in
> getBinOpPrecedence. However, we don't have the information to
> diagnose this language inconsistency until we know that we've parsed
> the '>>' as an operator and have both operands of the expression.
Ok,
Thanks Doug!
-Chris
More information about the cfe-commits
mailing list