[cfe-commits] r110568 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td lib/Parse/ParseCXXInlineMethods.cpp

Argyrios Kyrtzidis kyrtzidis at apple.com
Mon Aug 9 13:20:18 PDT 2010


On Aug 9, 2010, at 9:11 PM, Douglas Gregor wrote:

> 
> On Aug 9, 2010, at 12:55 PM, Chris Lattner wrote:
> 
>> 
>> On Aug 9, 2010, at 9:45 AM, Argyrios Kyrtzidis wrote:
>> 
>>>>> 
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=110568&view=rev
>>>>> Log:
>>>>> Replace a parser assertion with a warning, suggestion by Doug.
>>>> 
>>>> Testcase?
>>> 
>>> Non available, this is a "defensive" warning that should never be triggered, if it is triggered there is some kind of bug in clang that should be fixed.
>> 
>> It sounds like it should be an assert then... Doug?
> 
> No, not here. This check verifies that a "real" parse of an expression consumes exactly the same tokens as a "fake" balanced-delimiter parse used to cache the tokens. For well-formed code, this is an invariant. For ill-formed code, it's not an invariant, and we might not know that the code is ill-formed until we hit this point.
> 
> Here's a test case, by the way:
> 
> struct X {
>   void f(int x = 1:);
> };

Whoa whoa, totally misunderstood the issue, thanks for the test case!

> 
> Argiris, can you elevate this warning to an error, and perhaps word it so that it sounds more like a user error than a compiler issue? For example,
> 
> 	error: extra tokens are not part of the default argument expression

How about 'stealing' the one from Comeau:

  error: unexpected end of default argument expression

-Argiris


> 
> ?
> 
> 	- Doug
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100809/d5714f41/attachment.html>


More information about the cfe-commits mailing list