aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-05-03 18:24:37 +0000
committerDouglas Gregor <dgregor@apple.com>2010-05-03 18:24:37 +0000
commit4d9e7388ccdfdab97f92caac5db9b87a530742f4 (patch)
treee58f08f3a73124413e4880ca009511a09b4ba7f0 /lib/Sema/SemaInit.cpp
parent8fc6d236b8d05bad4b41a9be689b26d931adedd5 (diff)
Complain when we try to initialize an object of Objective-C class type
(which is ill-formed) with an initializer list. Also, change the fallback from an assertion to a generic error message, which is far friendlier. Fixes <rdar://problem/7730948>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102930 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaInit.cpp')
-rw-r--r--lib/Sema/SemaInit.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 5e6aa2c0a6..0aa3446177 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -624,10 +624,14 @@ void InitListChecker::CheckListElementTypes(const InitializedEntity &Entity,
} else if (DeclType->isReferenceType()) {
CheckReferenceType(Entity, IList, DeclType, Index,
StructuredList, StructuredIndex);
+ } else if (DeclType->isObjCInterfaceType()) {
+ SemaRef.Diag(IList->getLocStart(), diag::err_init_objc_class)
+ << DeclType;
+ hadError = true;
} else {
- // In C, all types are either scalars or aggregates, but
- // additional handling is needed here for C++ (and possibly others?).
- assert(0 && "Unsupported initializer type");
+ SemaRef.Diag(IList->getLocStart(), diag::err_illegal_initializer_type)
+ << DeclType;
+ hadError = true;
}
}