forked from OSchip/llvm-project
parent
84b4d2241f
commit
b80760bd78
|
@ -486,7 +486,6 @@ class CXXConstructExpr : public Expr {
|
||||||
|
|
||||||
Stmt **Args;
|
Stmt **Args;
|
||||||
unsigned NumArgs;
|
unsigned NumArgs;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T,
|
CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T,
|
||||||
|
|
|
@ -87,8 +87,24 @@ RValue CodeGenFunction::EmitReferenceBindingToExpr(const Expr* E,
|
||||||
return RValue::get(LV.getAddress());
|
return RValue::get(LV.getAddress());
|
||||||
Val = EmitLoadOfLValue(LV, E->getType());
|
Val = EmitLoadOfLValue(LV, E->getType());
|
||||||
} else {
|
} else {
|
||||||
|
// FIXME: Initializers don't work with casts yet. For example
|
||||||
|
// const A& a = B();
|
||||||
|
// if B inherits from A.
|
||||||
Val = EmitAnyExprToTemp(E, /*IsAggLocVolatile=*/false,
|
Val = EmitAnyExprToTemp(E, /*IsAggLocVolatile=*/false,
|
||||||
IsInitializer);
|
IsInitializer);
|
||||||
|
|
||||||
|
// We might have to destroy the temporary variable.
|
||||||
|
if (const RecordType *RT = E->getType()->getAs<RecordType>()) {
|
||||||
|
if (CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl())) {
|
||||||
|
if (!ClassDecl->hasTrivialDestructor()) {
|
||||||
|
const CXXDestructorDecl *Dtor =
|
||||||
|
ClassDecl->getDestructor(getContext());
|
||||||
|
|
||||||
|
CleanupScope scope(*this);
|
||||||
|
EmitCXXDestructorCall(Dtor, Dtor_Complete, Val.getAggregateAddr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Val.isAggregate()) {
|
if (Val.isAggregate()) {
|
||||||
|
|
Loading…
Reference in New Issue