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