InitListChecker::CheckListElementTypes(): Check for function types and issue an appropriate diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54614 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index bc38de3..a2add34 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -139,10 +139,11 @@
       CheckArrayType(IList, DeclType, Index);
     else
       assert(0 && "Aggregate that isn't a function or array?!");
-  } else if (DeclType->isVoidType()) {
-    // This is clearly invalid, so not much we can do here. Don't bother
-    // with a diagnostic; we'll give an error elsewhere.
+  } else if (DeclType->isVoidType() || DeclType->isFunctionType()) {
+    // This type is invalid, issue a diagnostic.
     Index++;
+    SemaRef->Diag(IList->getLocStart(), diag::err_illegal_initializer_type,
+                  DeclType.getAsString());
     hadError = true;
   } else {
     // In C, all types are either scalars or aggregates, but