of writing a __block variable being initialized with
a constructed object. // rdar://
11326988
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155673
91177308-0d34-0410-b5e6-
96231b3b80d8
bool hasInit = (ND->getInit() != 0);
// FIXME. rewriter does not support __block c++ objects which
// require construction.
- if (hasInit && dyn_cast<CXXConstructExpr>(ND->getInit()))
- hasInit = false;
+ if (hasInit)
+ if (CXXConstructExpr *CExp = dyn_cast<CXXConstructExpr>(ND->getInit())) {
+ CXXConstructorDecl *CXXDecl = CExp->getConstructor();
+ if (CXXDecl && CXXDecl->isDefaultConstructor())
+ hasInit = false;
+ }
+
unsigned flags = 0;
if (HasCopyAndDispose)
flags |= BLOCK_HAS_COPY_DISPOSE;
return BI2;
}
+// rdar://11326988
+typedef struct _z {
+ int location;
+ int length;
+} z;
+
+z w(int loc, int len);
+
+@interface rdar11326988
+@end
+@implementation rdar11326988
+- (void)y:(int)options {
+ __attribute__((__blocks__(byref))) z firstRange = w(1, 0);
+ options &= ~(1 | 2);
+}
+@end