summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaCXXCast.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaCXXCast.cpp')
-rw-r--r--clang/lib/Sema/SemaCXXCast.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaCXXCast.cpp b/clang/lib/Sema/SemaCXXCast.cpp
index 5753e7bce47..59df294772e 100644
--- a/clang/lib/Sema/SemaCXXCast.cpp
+++ b/clang/lib/Sema/SemaCXXCast.cpp
@@ -468,6 +468,8 @@ CheckReinterpretCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
!= TC_Success && msg != 0)
Self.Diag(OpRange.getBegin(), msg) << CT_Reinterpret
<< SrcExpr->getType() << DestType << OpRange;
+ else if (Kind == CastExpr::CK_Unknown || Kind == CastExpr::CK_BitCast)
+ Self.CheckCastAlign(SrcExpr, DestType, OpRange);
}
@@ -494,6 +496,8 @@ CheckStaticCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
Kind, BasePath) != TC_Success && msg != 0)
Self.Diag(OpRange.getBegin(), msg) << CT_Static
<< SrcExpr->getType() << DestType << OpRange;
+ else if (Kind == CastExpr::CK_Unknown || Kind == CastExpr::CK_BitCast)
+ Self.CheckCastAlign(SrcExpr, DestType, OpRange);
}
/// TryStaticCast - Check if a static cast can be performed, and do so if
@@ -1303,6 +1307,8 @@ Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr,
if (tcr != TC_Success && msg != 0)
Diag(R.getBegin(), msg) << (FunctionalStyle ? CT_Functional : CT_CStyle)
<< CastExpr->getType() << CastTy << R;
+ else if (Kind == CastExpr::CK_Unknown || Kind == CastExpr::CK_BitCast)
+ CheckCastAlign(CastExpr, CastTy, R);
return tcr != TC_Success;
}
OpenPOWER on IntegriCloud