aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/Wdangling-else-3.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common/Wdangling-else-3.c')
-rw-r--r--gcc/testsuite/c-c++-common/Wdangling-else-3.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/Wdangling-else-3.c b/gcc/testsuite/c-c++-common/Wdangling-else-3.c
new file mode 100644
index 00000000000..0dae0d54ec8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wdangling-else-3.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-Wparentheses -Wno-dangling-else" } */
+
+void bar (int);
+void
+foo (int a, int b)
+{
+ if (a) /* { dg-bogus "suggest explicit braces to avoid ambiguous" } */
+ if (b)
+ bar (1);
+ else
+ bar (2);
+}