[cfe-dev] Confusing diagnostic for initializing array with array

Steve Naroff snaroff at apple.com
Thu Feb 7 16:21:20 PST 2008


On Feb 7, 2008, at 4:14 PM, Eli Friedman wrote:

> Testcase:
> int test() {
> int a[10];
> int b[10] = a;
> }
>
> gives the following error:
> error: incompatible type initializing 'int [10]', expected 'int [10]'
>
> which is completely confusing.  This code obviously isn't legal, but
> reason has nothing to do with the type of the initializer.
>
> Not sure what the best wording for this error is, though.
>

This is what the EDG compiler says...
"ComeauTest.c", line 3: error: initialization with "{...}" expected  
for aggregate
           object
   int b[10] = a;
               ^
Which looks good to me.

snaroff

> -Eli
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list