On Mon, Sep 1, 2008 at 11:42 AM, Nuno Lopes <[EMAIL PROTECTED]> wrote:
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Sep  1 13:42:41 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.

>   Diag(Init->getExprLoc(), diag::err_init_element_not_constant,
>        Init->getSourceRange());
>   return true;
>
> Modified: cfe/trunk/test/Sema/array-init.c
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/array-init.c?rev=55609&r1=55608&r2=55609&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/Sema/array-init.c (original)
> +++ cfe/trunk/test/Sema/array-init.c Mon Sep  1 13:42:41 2008
> @@ -235,3 +235,6 @@
>        {(int) &dblfault_tss},
>        { (int)xpto},
>  };
> +
> +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.

-Eli
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to