[cfe-dev] New array/struct initializer parser bug

Steve Naroff snaroff at apple.com
Sat Oct 27 03:33:36 PDT 2007


clang has parsed initializers for quite some time.

Semantic analysis for structure initialization is still not done  
(there is a FIXME in the code).

clang should avoid producing bogus diagnostics. I'd prefer to have no  
diagnostics until we get around to doing the proper checking.

I'll try and look at this next week,

snaroff

On Oct 26, 2007, at 7:15 PM, Keith Bauer wrote:

> ... or were initializers not even being parsed before?
>
> CookieJar:~/Desktop keith$ cat > structinit.c
> struct s { int i; };
>
> struct s a[1] =
> {
>     { 3 }
> };
> CookieJar:~/Desktop keith$ clang -fsyntax-only structinit.c
> structinit.c:5:7: error: incompatible types assigning 'int' to  
> 'struct s'
>     { 3 }
>       ^
> structinit.c:5:7: warning: excess elements in array initializer
>     { 3 }
>       ^
> 2 diagnostics generated.
> CookieJar:~/Desktop keith$ gcc -fsyntax-only -Wall -Wextra  
> structinit.c
> CookieJar:~/Desktop keith$
>
> -Keith
> _______________________________________________
> 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