summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiate.cpp
diff options
context:
space:
mode:
authorErik Pilkington <erik.pilkington@gmail.com>2018-07-23 22:47:37 +0000
committerErik Pilkington <erik.pilkington@gmail.com>2018-07-23 22:47:37 +0000
commita3a462e5ca57789a5bc9f892f27a4d120f03b4c3 (patch)
treec1d61810df0d5f84c35313568b46fbbc7bb0d66e /clang/lib/Sema/SemaTemplateInstantiate.cpp
parentf96de0296023ef936d62191803ecb48622e6b085 (diff)
downloadbcm5719-llvm-a3a462e5ca57789a5bc9f892f27a4d120f03b4c3.tar.gz
bcm5719-llvm-a3a462e5ca57789a5bc9f892f27a4d120f03b4c3.zip
[Sema] Fix crash on BlockExprs in a default member initializers
Clang would crash when instantiating a BlockDecl that appeared in a default-member-initializer of a class template. Fix this by deferring the instantiation until we instantate the BlockExpr. rdar://41200624 Differential revision: https://reviews.llvm.org/D49688 llvm-svn: 337766
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiate.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 5a4a6bd033c..3cf584344c1 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -2083,6 +2083,11 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation,
if (Member->getDeclContext() != Pattern)
continue;
+ // BlockDecls can appear in a default-member-initializer. They must be the
+ // child of a BlockExpr, so we only know how to instantiate them from there.
+ if (isa<BlockDecl>(Member))
+ continue;
+
if (Member->isInvalidDecl()) {
Instantiation->setInvalidDecl();
continue;
OpenPOWER on IntegriCloud