summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-12-09 23:18:38 +0000
committerReid Kleckner <rnk@google.com>2015-12-09 23:18:38 +0000
commit4a09e8872f37b191e70a0664e687aae38549390c (patch)
treefb17385d6e1d233250cedcd329b470fad24cbb6f /clang/lib/Sema/SemaInit.cpp
parent5d2f7cfd44db983c5c21d36356c3319d792a90bc (diff)
downloadbcm5719-llvm-4a09e8872f37b191e70a0664e687aae38549390c.tar.gz
bcm5719-llvm-4a09e8872f37b191e70a0664e687aae38549390c.zip
Fix crash on invalid initialization with std::initializer_list
It is possible for CheckListElementTypes to fail without filling in any initializer list elements. llvm-svn: 255176
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 0f60ad10a3e..ba1f140a9e1 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -805,7 +805,8 @@ void InitListChecker::CheckImplicitInitList(const InitializedEntity &Entity,
unsigned EndIndex = (Index == StartIndex? StartIndex : Index - 1);
// Update the structured sub-object initializer so that it's ending
// range corresponds with the end of the last initializer it used.
- if (EndIndex < ParentIList->getNumInits()) {
+ if (EndIndex < ParentIList->getNumInits() &&
+ ParentIList->getInit(EndIndex)) {
SourceLocation EndLoc
= ParentIList->getInit(EndIndex)->getSourceRange().getEnd();
StructuredSubobjectInitList->setRBraceLoc(EndLoc);
OpenPOWER on IntegriCloud