зеркало из https://github.com/microsoft/clang-1.git
irgen for references to complex rvales (Very important...)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72157 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
9f75e6be16
Коммит
7cd3a648b3
|
@ -79,11 +79,17 @@ RValue CodeGenFunction::EmitReferenceBindingToExpr(const Expr* E,
|
|||
}
|
||||
|
||||
if (!hasAggregateLLVMType(E->getType())) {
|
||||
// Make a temporary variable that we can bind the reference to.
|
||||
// Create a temporary variable that we can bind the reference to.
|
||||
llvm::Value *Temp = CreateTempAlloca(ConvertTypeForMem(E->getType()),
|
||||
"reftmp");
|
||||
EmitStoreOfScalar(EmitScalarExpr(E), Temp, false, E->getType());
|
||||
return RValue::get(Temp);
|
||||
} else if (E->getType()->isAnyComplexType()) {
|
||||
// Create a temporary variable that we can bind the reference to.
|
||||
llvm::Value *Temp = CreateTempAlloca(ConvertTypeForMem(E->getType()),
|
||||
"reftmp");
|
||||
EmitComplexExprIntoAddr(E, Temp, false);
|
||||
return RValue::get(Temp);
|
||||
}
|
||||
|
||||
CGM.ErrorUnsupported(E, "reference binding");
|
||||
|
|
|
@ -44,6 +44,8 @@ void test_scalar() {
|
|||
void test_complex() {
|
||||
_Complex int a = 10i;
|
||||
f(a);
|
||||
|
||||
f(10i);
|
||||
}
|
||||
|
||||
void test_aggregate() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче