mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-15 12:39:19 +00:00
[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
This commit is contained in:
parent
f96de02960
commit
a3a462e5ca
@ -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;
|
||||
|
@ -30,3 +30,12 @@ int main(void)
|
||||
noret((float)0.0, double(0.0)); // expected-note {{in instantiation of function template specialization 'noret<float, double>' requested here}}
|
||||
}
|
||||
|
||||
namespace rdar41200624 {
|
||||
template <class T>
|
||||
struct S {
|
||||
int (^p)() = ^{ return 0; };
|
||||
T (^t)() = ^{ return T{}; };
|
||||
T s = ^{ return T{}; }();
|
||||
};
|
||||
S<int> x;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user