diff options
Diffstat (limited to 'clang/lib/Sema/SemaCast.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCast.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp index d986e3b..5360f8a 100644 --- a/clang/lib/Sema/SemaCast.cpp +++ b/clang/lib/Sema/SemaCast.cpp @@ -962,7 +962,7 @@ void CastOperation::CheckDynamicCast() { } // C++ 5.2.7p6: Otherwise, v shall be [polymorphic]. - const RecordDecl *SrcDecl = SrcRecord->getOriginalDecl()->getDefinition(); + const RecordDecl *SrcDecl = SrcRecord->getDecl()->getDefinition(); assert(SrcDecl && "Definition missing"); if (!cast<CXXRecordDecl>(SrcDecl)->isPolymorphic()) { Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_polymorphic) @@ -1453,7 +1453,7 @@ static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr, // converted to an integral type. [...] A value of a scoped enumeration type // can also be explicitly converted to a floating-point type [...]. if (const EnumType *Enum = dyn_cast<EnumType>(SrcType)) { - if (Enum->getOriginalDecl()->isScoped()) { + if (Enum->getDecl()->isScoped()) { if (DestType->isBooleanType()) { Kind = CK_IntegralToBoolean; return TC_Success; @@ -2927,6 +2927,8 @@ bool CastOperation::CheckHLSLCStyleCast(CheckedConversionKind CCK) { SrcExpr = Self.ImpCastExprToType( SrcExpr.get(), Self.Context.getArrayParameterType(SrcTy), CK_HLSLArrayRValue, VK_PRValue, nullptr, CCK); + else + SrcExpr = Self.DefaultLvalueConversion(SrcExpr.get()); Kind = CK_HLSLElementwiseCast; return true; } @@ -2935,6 +2937,7 @@ bool CastOperation::CheckHLSLCStyleCast(CheckedConversionKind CCK) { // If the relative order of this and the HLSLElementWise cast checks // are changed, it might change which cast handles what in a few cases if (Self.HLSL().CanPerformAggregateSplatCast(SrcExpr.get(), DestType)) { + SrcExpr = Self.DefaultLvalueConversion(SrcExpr.get()); const VectorType *VT = SrcTy->getAs<VectorType>(); // change splat from vec1 case to splat from scalar if (VT && VT->getNumElements() == 1) @@ -3105,7 +3108,7 @@ void CastOperation::CheckCStyleCast() { } // GCC's cast to union extension. - if (RecordDecl *RD = DestRecordTy->getOriginalDecl(); RD->isUnion()) { + if (RecordDecl *RD = DestRecordTy->getDecl(); RD->isUnion()) { if (CastExpr::getTargetFieldForToUnionCast(RD->getDefinitionOrSelf(), SrcType)) { Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_to_union) |