diff options
author | Anders Carlsson <andersca@mac.com> | 2009-09-07 18:25:47 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-09-07 18:25:47 +0000 |
commit | d851b37a331a7bc0047922ea9244aff85470987e (patch) | |
tree | 6edf2257c47afd5590ef252e64cccf3a0db08f45 /lib/Sema/SemaCXXCast.cpp | |
parent | 05c73c5f28eac0cacc263238e8ce3f86b9e17d8e (diff) |
Check that the destination type of a static_cast expression is a complete type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81151 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCXXCast.cpp')
-rw-r--r-- | lib/Sema/SemaCXXCast.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp index d88bbebec1..ceb2de7ae8 100644 --- a/lib/Sema/SemaCXXCast.cpp +++ b/lib/Sema/SemaCXXCast.cpp @@ -759,6 +759,14 @@ TryStaticImplicitCast(Sema &Self, Expr *SrcExpr, QualType DestType, bool CStyle, const SourceRange &OpRange, unsigned &msg, CXXMethodDecl *&ConversionDecl) { + if (DestType->isRecordType()) { + if (Self.RequireCompleteType(OpRange.getBegin(), DestType, + diag::err_bad_dynamic_cast_incomplete)) { + msg = 0; + return TC_Failed; + } + } + if (DestType->isReferenceType()) { // At this point of CheckStaticCast, if the destination is a reference, // this has to work. There is no other way that works. |