forked from OSchip/llvm-project
ObjectiveC++: support for passing C++11 style initialized temporaries to
objc++ properties using property-dot syntax. // rdar://14654207 llvm-svn: 192819
This commit is contained in:
parent
ac07c8dae7
commit
2eaec611ac
|
@ -730,6 +730,16 @@ ExprResult ObjCPropertyOpBuilder::buildSet(Expr *op, SourceLocation opcLoc,
|
|||
op = opResult.take();
|
||||
assert(op && "successful assignment left argument invalid?");
|
||||
}
|
||||
else if (OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(op)) {
|
||||
Expr *Initializer = OVE->getSourceExpr();
|
||||
// passing C++11 style initialized temporaries to objc++ properties
|
||||
// requires special treatment by removing OpaqueValueExpr so type
|
||||
// conversion takes place and adding the OpaqueValueExpr later on.
|
||||
if (isa<InitListExpr>(Initializer) &&
|
||||
Initializer->getType()->isVoidType()) {
|
||||
op = Initializer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Arguments.
|
||||
|
|
|
@ -172,3 +172,34 @@ namespace test10 {
|
|||
@implementation PropertyOfItself
|
||||
@synthesize x;
|
||||
@end
|
||||
|
||||
// rdar://14654207
|
||||
struct CGSize {
|
||||
double width;
|
||||
double height;
|
||||
};
|
||||
typedef struct CGSize CGSize;
|
||||
|
||||
struct CGRect {
|
||||
CGSize origin;
|
||||
CGSize size;
|
||||
};
|
||||
typedef struct CGRect CGRect;
|
||||
|
||||
typedef CGRect NSRect;
|
||||
void HappySetFrame(NSRect frame) {}
|
||||
|
||||
__attribute__((objc_root_class))
|
||||
@interface NSObject
|
||||
@property CGRect frame;
|
||||
@end
|
||||
|
||||
@implementation NSObject
|
||||
- (void) nothing
|
||||
{
|
||||
HappySetFrame({{0,0}, {13,14}});
|
||||
[self setFrame: {{0,0}, {13,14}}];
|
||||
self.frame = {{0,0}, {13,14}};
|
||||
self.frame = (CGRect){{3,5}, {13,14}};
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue