diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2010-07-17 20:43:49 +0000 | 
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2010-07-17 20:43:49 +0000 | 
| commit | e98194d9e8d2ede5eeaa4de411ffe1697ed6a40e (patch) | |
| tree | a3f538fdf054f07e069c8831f0f6ea2156537f35 /clang/lib/Sema/SemaExpr.cpp | |
| parent | 2155e6539e0c75481f655efc7fb9406d034db3a2 (diff) | |
| download | bcm5719-llvm-e98194d9e8d2ede5eeaa4de411ffe1697ed6a40e.tar.gz bcm5719-llvm-e98194d9e8d2ede5eeaa4de411ffe1697ed6a40e.zip | |
Check for casts to an incomplete type in C.  Improves diagnostics for cast to
incomplete union (PR5692) and incomplete enum, and fixes obscure
accepts-invalid on cast to incomplete struct.
llvm-svn: 108630
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 4 | 
1 files changed, 4 insertions, 0 deletions
| diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index d798d9d0e5c..2d3aaf6edc0 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3891,6 +3891,10 @@ bool Sema::CheckCastTypes(SourceRange TyR, QualType castType, Expr *&castExpr,      return false;    } +  if (RequireCompleteType(TyR.getBegin(), castType, +                          diag::err_typecheck_cast_to_incomplete)) +    return true; +    if (!castType->isScalarType() && !castType->isVectorType()) {      if (Context.hasSameUnqualifiedType(castType, castExpr->getType()) &&          (castType->isStructureType() || castType->isUnionType())) { | 

