which is lifetime-extended by a reference binding. An additional temporary is
created for such a bitfield access (although we have no explicit AST
representation for it).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183095
91177308-0d34-0410-b5e6-
96231b3b80d8
if (!ME->isArrow() && ME->getBase()->isRValue()) {
assert(ME->getBase()->getType()->isRecordType());
if (FieldDecl *Field = dyn_cast<FieldDecl>(ME->getMemberDecl())) {
- E = ME->getBase();
- Adjustments.push_back(SubobjectAdjustment(Field));
- continue;
+ if (!Field->isBitField()) {
+ E = ME->getBase();
+ Adjustments.push_back(SubobjectAdjustment(Field));
+ continue;
+ }
}
}
} else if (const BinaryOperator *BO = dyn_cast<BinaryOperator>(E)) {
// CHECK: store i32* {{.*}}, i32** @_ZN15BindToSubobject1dE, align 8
int &&d = (B().a).*h();
}
+
+namespace Bitfield {
+ struct S { int a : 5; ~S(); };
+
+ // Do not lifetime extend the S() temporary here.
+ // CHECK: alloca
+ // CHECK: call {{.*}}memset
+ // CHECK: store i32 {{.*}}, i32* @_ZGRN8Bitfield1rE, align 4
+ // CHECK: call void @_ZN8Bitfield1SD1
+ // CHECK: store i32* @_ZGRN8Bitfield1rE, i32** @_ZN8Bitfield1rE, align 8
+ int &&r = S().a;
+}