diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-11-18 12:04:04 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-11-18 12:04:04 +0000 |
commit | 994ed53db24514d5a39bd82c364b4410bc98594f (patch) | |
tree | cdd324d1e6fe35bb3126556453b500b8ceed2c4a /gcc/testsuite/gcc.dg/nested-func-1.c | |
parent | c73904bb0081ff780aaf18ff4f914be12c427852 (diff) | |
download | gcc-994ed53db24514d5a39bd82c364b4410bc98594f.tar.gz |
* gcc.dg/nested-func-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73701 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/nested-func-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/nested-func-1.c | 35 |
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 00000000000..cb26e895e5c --- /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" } */ + } +} |