[PATCH] Force a load when creating a reference to a temporary copied from a bitfield.

Jordan Rose jordan_rose at apple.com
Wed Apr 10 11:00:32 PDT 2013

Comment at: lib/AST/ExprConstant.cpp:2869
@@ -2871,1 +2868,3 @@
+  if (E->getType()->isRecordType())
+    return EvaluateTemporary(E->GetTemporaryExpr(), Result, Info);
Doug Gregor wrote:
> Yay!
> Dare we kill CodeGen's hackery for this AST brokenness as well?
I made some silly mistakes untangling CodeGen's hack, but I think I got it right. I'll include that in the next version.

Comment at: lib/Sema/SemaInit.cpp:3383
@@ +3382,3 @@
+    assert(!ICS.isBad());
+    Sequence.AddConversionSequenceStep(ICS, cv1T1);
+    return VK_RValue;
Doug Gregor wrote:
> A conversion sequence step is a fairly heavy way to introduce an lvalue-to-rvalue conversion. Why not add a new InitializationSequence::StepKind that simply maps down to a  CK_LValueToRRalue implicit cast? I guess one would still have to potentially add a qualification conversion step, but I'd prefer that simple path over a full ICS.
I didn't do it because it wasn't there, but that certainly seems reasonable to add.


More information about the cfe-commits mailing list