aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/AnalysisBasedWarnings.cpp2
-rw-r--r--test/SemaCXX/switch-implicit-fallthrough.cpp5
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp
index b362239163..5443edb191 100644
--- a/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/lib/Sema/AnalysisBasedWarnings.cpp
@@ -714,7 +714,7 @@ namespace {
for (CFGBlock::const_succ_iterator I = P->succ_begin(),
E = P->succ_end();
I != E; ++I) {
- if (ReachableBlocks.insert(*I))
+ if (*I && ReachableBlocks.insert(*I))
BlockQueue.push_back(*I);
}
}
diff --git a/test/SemaCXX/switch-implicit-fallthrough.cpp b/test/SemaCXX/switch-implicit-fallthrough.cpp
index 912b21ebfd..bc94c9e750 100644
--- a/test/SemaCXX/switch-implicit-fallthrough.cpp
+++ b/test/SemaCXX/switch-implicit-fallthrough.cpp
@@ -172,6 +172,11 @@ int fallthrough_macro1(int n) {
return n;
}
+void fallthrough_cfgblock_with_null_successor(int x) {
+ (x && "") ? (void)(0) : (void)(1);
+ switch (x) {}
+}
+
int fallthrough_position(int n) {
switch (n) {
[[clang::fallthrough]]; // expected-warning{{fallthrough annotation in unreachable code}}