[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

Anders Carlsson andersca at mac.com
Sun Nov 30 19:58:44 PST 2008


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.

Anders

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2415 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20081130/ade565cb/attachment.bin>


More information about the cfe-commits mailing list