forked from OSchip/llvm-project
Don't crash (assert failure) when generating blocks for C++ types with a non-const copy constructor.
This was caused by the code deciding the number of fields in the byref structure using a different test to the part of the code creating the GEPs into said structure. llvm-svn: 154013
This commit is contained in:
parent
d01a99ea41
commit
5221a947a5
|
@ -1850,7 +1850,8 @@ llvm::Type *CodeGenFunction::BuildByRefType(const VarDecl *D) {
|
|||
// int32_t __size;
|
||||
types.push_back(Int32Ty);
|
||||
|
||||
bool HasCopyAndDispose = getContext().BlockRequiresCopying(Ty);
|
||||
bool HasCopyAndDispose =
|
||||
(Ty->isObjCRetainableType()) || getContext().getBlockVarCopyInits(D);
|
||||
if (HasCopyAndDispose) {
|
||||
/// void *__copy_helper;
|
||||
types.push_back(Int8PtrTy);
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks
|
||||
// Just test that this doesn't crash the compiler...
|
||||
|
||||
void func(void*);
|
||||
|
||||
struct Test
|
||||
{
|
||||
virtual void use() { func((void*)this); }
|
||||
Test(Test&c) { func((void*)this); }
|
||||
Test() { func((void*)this); }
|
||||
};
|
||||
|
||||
void useBlock(void (^)(void));
|
||||
|
||||
int main (void) {
|
||||
__block Test t;
|
||||
useBlock(^(void) { t.use(); });
|
||||
}
|
||||
|
Loading…
Reference in New Issue