[cfe-commits] r60319 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Sema/Sema.h lib/Sema/SemaExpr.cpp test/Sema/i-c-e3.c

Eli Friedman eli.friedman at gmail.com
Sun Nov 30 20:30:53 PST 2008


On Sun, Nov 30, 2008 at 7:58 PM, Anders Carlsson <andersca at mac.com> wrote:
>
> 30 nov 2008 kl. 19.41 skrev Eli Friedman:
>
>> On Sun, Nov 30, 2008 at 6:17 PM, Anders Carlsson <andersca at mac.com> wrote:
>>
>> =============================================================================
>>>
>>> --- cfe/trunk/test/Sema/i-c-e3.c (original)
>>> +++ cfe/trunk/test/Sema/i-c-e3.c Sun Nov 30 20:17:22 2008
>>> @@ -1,3 +1,3 @@
>>> -// RUN: clang %s -fsyntax-only -verify -pedantic
>>> +// RUN: clang %s -fsyntax-only -verify -pedantic-errors
>>>
>>> -int a() {int p; *(1 ? &p : (void*)(0 && (a(),1))) = 10;} //
>>> expected-error {{not assignable}}
>>> +int a() {int p; *(1 ? &p : (void*)(0 && (a(),1))) = 10;} //
>>> expected-error {{null pointer expression is not an integer constant
>>> expression (but is allowed as an extension)}} // expected-note{{C does not
>>> permit evaluated commas in an integer constant expression}}
>>
>> This looks wrong; we shouldn't be giving a pedantic error because
>> something that isn't a null pointer constant looks like one.  How does
>> the new code handle just "(1 ? &p : (void*)(0 && (a(),1)));"?
>>
>
> It handles it just fine
>
> test.c:1:17: warning: expression result unused
> int a() {int p; (1 ? &p : (void*)(0 && (a(),1)));}
>                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Note that it only gives an error if the -pedantic-errors flag is used.

Okay... sorry, I haven't read all your changes in detail; what
suppresses the warning here?

-Eli



More information about the cfe-commits mailing list