aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/nested-func-1.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm@polyomino.org.uk>2003-11-18 12:04:04 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2003-11-18 12:04:04 +0000
commitfc6d6d62cf380294ecda48519c94ed5187a2df5e (patch)
treecdd324d1e6fe35bb3126556453b500b8ceed2c4a /gcc/testsuite/gcc.dg/nested-func-1.c
parent0d77ab84bb83effb9ac3e41635747a658a3332f6 (diff)
downloadgcc-fc6d6d62cf380294ecda48519c94ed5187a2df5e.zip
gcc-fc6d6d62cf380294ecda48519c94ed5187a2df5e.tar.gz
gcc-fc6d6d62cf380294ecda48519c94ed5187a2df5e.tar.bz2
* gcc.dg/nested-func-1.c: New test.
From-SVN: r73701
Diffstat (limited to 'gcc/testsuite/gcc.dg/nested-func-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/nested-func-1.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/nested-func-1.c b/gcc/testsuite/gcc.dg/nested-func-1.c
new file mode 100644
index 0000000..cb26e89
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/nested-func-1.c
@@ -0,0 +1,35 @@
+/* Test for proper errors for break and continue in nested functions. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+foo (int a)
+{
+ switch (a) {
+ void bar1 (void) { break; } /* { dg-error "break statement" "break switch 1" } */
+ }
+ switch (a) {
+ case 0:
+ (void) 0;
+ void bar2 (void) { break; } /* { dg-error "break statement" "break switch 2" } */
+ }
+ while (1) {
+ void bar3 (void) { break; } /* { dg-error "break statement" "break while" } */
+ }
+ do {
+ void bar4 (void) { break; } /* { dg-error "break statement" "break do" } */
+ } while (1);
+ for (;;) {
+ void bar5 (void) { break; } /* { dg-error "break statement" "break for" } */
+ }
+ while (1) {
+ void bar6 (void) { continue; } /* { dg-error "continue statement" "continue while" } */
+ }
+ do {
+ void bar7 (void) { continue; } /* { dg-error "continue statement" "continue do" } */
+ } while (1);
+ for (;;) {
+ void bar8 (void) { continue; } /* { dg-error "continue statement" "continue for" } */
+ }
+}