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

Nuno Lopes nunoplopes at sapo.pt
Mon Sep 1 11:42:41 PDT 2008


Author: nlopes
Date: Mon Sep  1 13:42:41 2008
New Revision: 55609

URL: http://llvm.org/viewvc/llvm-project?rev=55609&view=rev
Log:
fix one more this-is-not-a-constant error. test included

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/Sema/array-init.c

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=55609&r1=55608&r2=55609&view=diff

==============================================================================
--- 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;
+
   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}}





More information about the cfe-commits mailing list