[cfe-commits] r55609 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/array-init.c

Nuno Lopes nunoplopes at sapo.pt
Mon Sep 1 15:21:43 PDT 2008


>> @@ -1269,6 +1269,9 @@
>>   if (Init->getType()->isArrayType())
>>     return false;
>>
>> +  if (Init->getType()->isFunctionType())
>> +    return false;
>> +
>
> I'm not sure this fix makes sense; it seems a little messy to me,
> although I hadn't really considered this case when I wrote the code.
> Maybe we should do unary promotions as part of error recovery for
> excess initializer elements?  Or maybe we shouldn't be trying to check
> elements that we aren't going to use?  Or maybe we should just make
> the excess elements warning into an error, because it most likely
> indicates something seriously screwed up with either the code in
> question or the way it's being parsed.

I'll revert this anyway. I didn't really understand why the execution flow 
gets here. It seems there's a little code duplication on this constant 
initializer checking..


>> +static void sppp_ipv6cp_up();
>> +const struct {} ipcp = { sppp_ipv6cp_up }; //expected-warning{{empty 
>> struct extension}} expected-warning{{excess elements in array 
>> initializer}}
>
> Is there really any point to accepting this code?  Nobody would ever
> write something like this intentionally.

GCC accepts it and I it would be great if clang would accept it as well. I 
got this test case when I was doing some delta reducing and I still have 
many test cases that stop in stupid things like these one.

Nuno 




More information about the cfe-commits mailing list