summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/label-decl-4.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/label-decl-4.c')
-rw-r--r--gcc/testsuite/gcc.dg/label-decl-4.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/label-decl-4.c b/gcc/testsuite/gcc.dg/label-decl-4.c
new file mode 100644
index 000000000..3cfe965fd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/label-decl-4.c
@@ -0,0 +1,14 @@
+/* Test diagnostics for duplicate label declarations. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+f (void)
+{
+ __label__ a, b, a; /* { dg-error "duplicate label declaration 'a'" } */
+ /* { dg-message "note: previous declaration of 'a' was here" "previous" { target *-*-* } 9 } */
+ __label__ c; /* { dg-message "note: previous declaration of 'c' was here" } */
+ __label__ c; /* { dg-error "duplicate label declaration 'c'" } */
+ return;
+}