forked from OSchip/llvm-project
Don't intentionally try to ignore the value of a scalar expression when we
actually care about it. Fixes PR7291. llvm-svn: 105404
This commit is contained in:
parent
3b61d21fac
commit
cce5b81ce1
|
@ -467,7 +467,7 @@ static void EmitMemberInitializer(CodeGenFunction &CGF,
|
|||
} else if (FieldType->isArrayType() && !MemberInit->getInit()) {
|
||||
CGF.EmitNullInitialization(LHS.getAddress(), Field->getType());
|
||||
} else if (!CGF.hasAggregateLLVMType(Field->getType())) {
|
||||
RHS = RValue::get(CGF.EmitScalarExpr(MemberInit->getInit(), true));
|
||||
RHS = RValue::get(CGF.EmitScalarExpr(MemberInit->getInit()));
|
||||
CGF.EmitStoreThroughLValue(RHS, LHS, FieldType);
|
||||
} else if (MemberInit->getInit()->getType()->isAnyComplexType()) {
|
||||
CGF.EmitComplexExprIntoAddr(MemberInit->getInit(), LHS.getAddress(),
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: %clang_cc1 %s -emit-llvm-only -verify
|
||||
// PR7291
|
||||
|
||||
struct Foo {
|
||||
unsigned file_id;
|
||||
|
||||
Foo(unsigned arg);
|
||||
};
|
||||
|
||||
Foo::Foo(unsigned arg) : file_id(arg = 42)
|
||||
{ }
|
||||
|
Loading…
Reference in New Issue