void
AggExprEmitter::EmitInitializationToLValue(Expr* E, LValue LV, QualType T) {
- // FIXME: Remove this.
- T = E->getType();
-
// FIXME: Ignore result?
// FIXME: Are initializers affected by volatile?
if (isa<ImplicitValueInitExpr>(E)) {
EmitNullInitializationToLValue(LV, T);
+ } else if (T->isReferenceType()) {
+ RValue RV = CGF.EmitReferenceBindingToExpr(E, /*IsInitializer=*/false);
+ CGF.EmitStoreThroughLValue(RV, LV, T);
} else if (T->isAnyComplexType()) {
CGF.EmitComplexExprIntoAddr(E, LV.getAddress(), false);
} else if (CGF.hasAggregateLLVMType(T)) {
// FIXME: volatility
FieldDecl *Field = E->getInitializedFieldInUnion();
- LValue FieldLoc = CGF.EmitLValueForField(DestPtr, Field, 0);
+ LValue FieldLoc = CGF.EmitLValueForFieldInitialization(DestPtr, Field, 0);
if (NumInitElements) {
// Store the initializer into the field
continue;
// FIXME: volatility
- LValue FieldLoc = CGF.EmitLValueForField(DestPtr, *Field, 0);
+ LValue FieldLoc = CGF.EmitLValueForFieldInitialization(DestPtr, *Field, 0);
// We never generate write-barries for initialized fields.
LValue::SetObjCNonGC(FieldLoc, true);
if (CurInitVal < NumInitElements) {
bool_reference_return() = true;
a = bool_reference_return();
+
+ struct { const bool& b; } b = { true };
}
void test_scalar() {
int_reference_return() = 10;
a = int_reference_return();
+
+ struct { const int& a; } agg = { 10 };
}
void test_complex() {
complex_int_reference_return() = 10i;
a = complex_int_reference_return();
+
+ struct { const _Complex int &a; } agg = { 10i };
}
void test_aggregate() {
aggregate_reference_return().a = 10;
c = aggregate_reference_return();
+
+ struct { const C& a; } agg = { C() };
}
int& reference_return() {