From 73419bf6cbf8e5f7a0f9b8855d6531db264ae899 Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Mon, 1 Sep 2008 18:42:41 +0000 Subject: [PATCH] fix one more this-is-not-a-constant error. test included git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55609 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDecl.cpp | 3 +++ test/Sema/array-init.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index bf7c690ac2..d93a5eca5f 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/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/test/Sema/array-init.c b/test/Sema/array-init.c index 7d6e6c6d28..bf3d83d265 100644 --- a/test/Sema/array-init.c +++ b/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}} -- 2.50.1