summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/AST/Stmt.h1
-rw-r--r--clang/lib/Sema/SemaChecking.cpp5
-rw-r--r--clang/test/SemaCXX/warn-unreachable.cpp5
3 files changed, 9 insertions, 2 deletions
diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h
index 1cfa5934cb2..d058f838a00 100644
--- a/clang/include/clang/AST/Stmt.h
+++ b/clang/include/clang/AST/Stmt.h
@@ -24,7 +24,6 @@
#include "llvm/ADT/SmallVector.h"
#include "clang/AST/ASTContext.h"
#include <string>
-#include <iterator>
using llvm::dyn_cast_or_null;
namespace llvm {
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 018132c3681..b792ea8071c 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -2121,6 +2121,11 @@ static SourceLocation GetUnreachableLoc(CFGBlock &b, SourceRange &R1,
R1 = CSC->getSubExpr()->getSourceRange();
return CSC->getLParenLoc();
}
+ case Expr::CXXFunctionalCastExprClass: {
+ const CXXFunctionalCastExpr *CE = cast <CXXFunctionalCastExpr>(S);
+ R1 = CE->getSubExpr()->getSourceRange();
+ return CE->getTypeBeginLoc();
+ }
case Expr::ImplicitCastExprClass:
++sn;
goto top;
diff --git a/clang/test/SemaCXX/warn-unreachable.cpp b/clang/test/SemaCXX/warn-unreachable.cpp
index 852943f01da..9e3eb163af5 100644
--- a/clang/test/SemaCXX/warn-unreachable.cpp
+++ b/clang/test/SemaCXX/warn-unreachable.cpp
@@ -40,6 +40,9 @@ void test3() {
halt()
--; // expected-warning {{will never be executed}}
halt()
- ? // expected-warning {{will never be executed}}
+ ? // expected-warning {{will never be executed}}
dead() : dead();
+ live(),
+ float // expected-warning {{will never be executed}}
+ (halt());
}
OpenPOWER on IntegriCloud