aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/warn/Wswitch-unreachable-1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/warn/Wswitch-unreachable-1.C')
-rw-r--r--gcc/testsuite/g++.dg/warn/Wswitch-unreachable-1.C34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/Wswitch-unreachable-1.C b/gcc/testsuite/g++.dg/warn/Wswitch-unreachable-1.C
new file mode 100644
index 00000000000..99d9a833217
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wswitch-unreachable-1.C
@@ -0,0 +1,34 @@
+// { dg-do compile }
+
+extern int j;
+
+void
+f (int i)
+{
+ switch (i) // { dg-warning "statement will never be executed" }
+ {
+ try
+ {
+ }
+ catch (...)
+ {
+ }
+ case 1:;
+ }
+}
+
+void
+g (int i)
+{
+ switch (i)
+ {
+ try
+ {
+ j = 42; // { dg-warning "statement will never be executed" }
+ }
+ catch (...)
+ {
+ }
+ case 1:;
+ }
+}