summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2008-09-01 18:42:41 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2008-09-01 18:42:41 +0000
commit2c5208c59fcdae2e47fe8f98e6506bb098ea2005 (patch)
tree1abdf0099d67ce56edc7476c8428865c4e83923e
parent9c64e6117623e5d46474880d18464c2640032ed1 (diff)
fix one more this-is-not-a-constant error. test included
llvm-svn: 55609
-rw-r--r--clang/lib/Sema/SemaDecl.cpp3
-rw-r--r--clang/test/Sema/array-init.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index bf7c690ac2bc..d93a5eca5f80 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1269,6 +1269,9 @@ bool Sema::CheckForConstantInitializer(Expr *Init, QualType DclT) {
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;
diff --git a/clang/test/Sema/array-init.c b/clang/test/Sema/array-init.c
index 7d6e6c6d281d..bf3d83d2654c 100644
--- a/clang/test/Sema/array-init.c
+++ b/clang/test/Sema/array-init.c
@@ -235,3 +235,6 @@ struct soft_segment_descriptor gdt_segs[] = {
{(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}}