diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-11-23 13:53:21 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-11-23 13:53:21 +0000 |
| commit | 378e1923b6a5553ba7aa3d24e6cdd6b80064470b (patch) | |
| tree | 9796aa3fbe89703c2bd0c28684ad70b02ceec50c /clang/lib/Sema/SemaStmt.cpp | |
| parent | d0c22e0d10fc9e7df2a8fa1431d0c5eb5c5bd341 (diff) | |
| download | bcm5719-llvm-378e1923b6a5553ba7aa3d24e6cdd6b80064470b.tar.gz bcm5719-llvm-378e1923b6a5553ba7aa3d24e6cdd6b80064470b.zip | |
Require a class type to be complete before probing its conversion
functions for a switch condition's conversion to integral or
enumeration type.
llvm-svn: 89656
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index b674a1738cc..ad3376b9c82 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -391,6 +391,13 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, StmtArg Switch, // conversion is used in place of the original condition for the remainder // of this section. Integral promotions are performed. if (!CondExpr->isTypeDependent()) { + // Make sure that the condition expression has a complete type, + // otherwise we'll never find any conversions. + if (RequireCompleteType(SwitchLoc, CondType, + PDiag(diag::err_switch_incomplete_class_type) + << CondExpr->getSourceRange())) + return StmtError(); + llvm::SmallVector<CXXConversionDecl *, 4> ViableConversions; llvm::SmallVector<CXXConversionDecl *, 4> ExplicitConversions; if (const RecordType *RecordTy = CondType->getAs<RecordType>()) { |

