]> granicus.if.org Git - clang/commitdiff
Fix r137086 to actually work properly in general. PR10650.
authorEli Friedman <eli.friedman@gmail.com>
Sun, 14 Aug 2011 04:50:34 +0000 (04:50 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Sun, 14 Aug 2011 04:50:34 +0000 (04:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137574 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprScalar.cpp
test/CodeGenCXX/reference-cast.cpp

index 4038be279263cd78ddddce791e85ca4781b1bdf3..f4a2695ec9d50dd55d993ba50c8983baeacf05f6 100644 (file)
@@ -344,8 +344,7 @@ public:
     
   // C++
   Value *VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *E) {
-    RValue RV = CGF.EmitLoadOfLValue(CGF.EmitLValue(E->GetTemporaryExpr()));
-    return RV.getScalarVal();
+    return EmitLoadOfLValue(E);
   }
     
   Value *VisitCXXDefaultArgExpr(CXXDefaultArgExpr *DAE) {
index 549434e941478d4c43bf6e96a411312e3a7bba2c..1d08b2b2e4b7b2dc3ca04ab655cd05787fb88481 100644 (file)
@@ -181,3 +181,14 @@ unsigned pr10592(const int &v) {
   // CHECK-NEXT: ret i32 [[VVAL_I]]
   return static_cast<const unsigned &>(v);
 }
+
+namespace PR10650 {
+  struct Helper {
+    unsigned long long id();
+  };
+  unsigned long long test(Helper *obj) {
+    return static_cast<const unsigned long long&>(obj->id());
+  }
+  // CHECK: define i64 @_ZN7PR106504testEPNS_6HelperE
+  // CHECK: store i64
+}