diff options
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 5 | ||||
-rw-r--r-- | test/Sema/warn-unreachable.c | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 9fadd45fbb..018132c368 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -2116,6 +2116,11 @@ static SourceLocation GetUnreachableLoc(CFGBlock &b, SourceRange &R1, const ConditionalOperator *CO = cast<ConditionalOperator>(S); return CO->getQuestionLoc(); } + case Expr::CStyleCastExprClass: { + const CStyleCastExpr *CSC = cast<CStyleCastExpr>(S); + R1 = CSC->getSubExpr()->getSourceRange(); + return CSC->getLParenLoc(); + } case Expr::ImplicitCastExprClass: ++sn; goto top; diff --git a/test/Sema/warn-unreachable.c b/test/Sema/warn-unreachable.c index 7c913cafb2..b569b18159 100644 --- a/test/Sema/warn-unreachable.c +++ b/test/Sema/warn-unreachable.c @@ -87,5 +87,8 @@ void test2() { halt() ? // expected-warning {{will never be executed}} dead() : dead(); + case 10: + ( // expected-warning {{will never be executed}} + float)halt(); } } |