diff options
author | Douglas Gregor <dgregor@apple.com> | 2016-02-03 19:13:08 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2016-02-03 19:13:08 +0000 |
commit | 0fc3a001682c0bd076a329024192e57b3bc950fd (patch) | |
tree | 08abfa09d4a0537d8a966784e86e3c6d33e9129f /clang/lib/Sema/SemaExpr.cpp | |
parent | 62d3a6570afd635986912a7b9cb5791bc37da137 (diff) | |
download | bcm5719-llvm-0fc3a001682c0bd076a329024192e57b3bc950fd.tar.gz bcm5719-llvm-0fc3a001682c0bd076a329024192e57b3bc950fd.zip |
[Sema debugger support] Require non-void types to be complete in unknown-anytype casts.
When performing a cast from an __unknown_anytype function call to a
non-void type, we need to make sure that type is complete. Fixes
rdar://problem/23959960.
llvm-svn: 259681
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index b7d494fa5cb..dc638798d10 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -14478,6 +14478,12 @@ ExprResult RebuildUnknownAnyExpr::resolveDecl(Expr *E, ValueDecl *VD) { ExprResult Sema::checkUnknownAnyCast(SourceRange TypeRange, QualType CastType, Expr *CastExpr, CastKind &CastKind, ExprValueKind &VK, CXXCastPath &Path) { + // The type we're casting to must be either void or complete. + if (!CastType->isVoidType() && + RequireCompleteType(TypeRange.getBegin(), CastType, + diag::err_typecheck_cast_to_incomplete)) + return ExprError(); + // Rewrite the casted expression from scratch. ExprResult result = RebuildUnknownAnyExpr(*this, CastType).Visit(CastExpr); if (!result.isUsable()) return ExprError(); |