diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2020-01-22 21:31:48 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2020-01-22 21:31:48 +0000 |
| commit | a7dea1671b87c07d2d266f836bfa8b58efc7c134 (patch) | |
| tree | ff67344b3b18fc14e0cec322849afb4e3b94ea56 /contrib/llvm-project/clang/lib/Sema/SemaCast.cpp | |
| parent | 5c713029ff7939f90b6f96df914953e758855a7f (diff) | |
| parent | 519fc96c475680de2cc49e7811dbbfadb912cbcc (diff) | |
Notes
Diffstat (limited to 'contrib/llvm-project/clang/lib/Sema/SemaCast.cpp')
| -rw-r--r-- | contrib/llvm-project/clang/lib/Sema/SemaCast.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaCast.cpp b/contrib/llvm-project/clang/lib/Sema/SemaCast.cpp index f184eda2f273..0ebb5c68f7c2 100644 --- a/contrib/llvm-project/clang/lib/Sema/SemaCast.cpp +++ b/contrib/llvm-project/clang/lib/Sema/SemaCast.cpp @@ -1304,6 +1304,7 @@ TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, bool DerivedToBase; bool ObjCConversion; bool ObjCLifetimeConversion; + bool FunctionConversion; QualType FromType = SrcExpr->getType(); QualType ToType = R->getPointeeType(); if (CStyle) { @@ -1313,7 +1314,7 @@ TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, Sema::ReferenceCompareResult RefResult = Self.CompareReferenceRelationship( SrcExpr->getBeginLoc(), ToType, FromType, DerivedToBase, ObjCConversion, - ObjCLifetimeConversion); + ObjCLifetimeConversion, FunctionConversion); if (RefResult != Sema::Ref_Compatible) { if (CStyle || RefResult == Sema::Ref_Incompatible) return TC_NotApplicable; @@ -2799,6 +2800,15 @@ void CastOperation::CheckCStyleCast() { void CastOperation::CheckBuiltinBitCast() { QualType SrcType = SrcExpr.get()->getType(); + + if (Self.RequireCompleteType(OpRange.getBegin(), DestType, + diag::err_typecheck_cast_to_incomplete) || + Self.RequireCompleteType(OpRange.getBegin(), SrcType, + diag::err_incomplete_type)) { + SrcExpr = ExprError(); + return; + } + if (SrcExpr.get()->isRValue()) SrcExpr = Self.CreateMaterializeTemporaryExpr(SrcType, SrcExpr.get(), /*IsLValueReference=*/false); @@ -2826,11 +2836,6 @@ void CastOperation::CheckBuiltinBitCast() { return; } - if (Self.Context.hasSameUnqualifiedType(DestType, SrcType)) { - Kind = CK_NoOp; - return; - } - Kind = CK_LValueToRValueBitCast; } |
