summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaCast.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaCast.cpp')
-rw-r--r--clang/lib/Sema/SemaCast.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp
index 7a1d52ad4ea..71e5e8e4286 100644
--- a/clang/lib/Sema/SemaCast.cpp
+++ b/clang/lib/Sema/SemaCast.cpp
@@ -2799,9 +2799,6 @@ void CastOperation::CheckCStyleCast() {
void CastOperation::CheckBuiltinBitCast() {
QualType SrcType = SrcExpr.get()->getType();
- if (SrcExpr.get()->isRValue())
- SrcExpr = Self.CreateMaterializeTemporaryExpr(SrcType, SrcExpr.get(),
- /*IsLValueReference=*/false);
if (Self.RequireCompleteType(OpRange.getBegin(), DestType,
diag::err_typecheck_cast_to_incomplete) ||
@@ -2811,6 +2808,10 @@ void CastOperation::CheckBuiltinBitCast() {
return;
}
+ if (SrcExpr.get()->isRValue())
+ SrcExpr = Self.CreateMaterializeTemporaryExpr(SrcType, SrcExpr.get(),
+ /*IsLValueReference=*/false);
+
CharUnits DestSize = Self.Context.getTypeSizeInChars(DestType);
CharUnits SourceSize = Self.Context.getTypeSizeInChars(SrcType);
if (DestSize != SourceSize) {
OpenPOWER on IntegriCloud