diff options
author | phython <phython@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-12-21 17:01:08 +0000 |
---|---|---|
committer | phython <phython@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-12-21 17:01:08 +0000 |
commit | 61ba37bfdc89277570f40931fdfeb82dfefc5585 (patch) | |
tree | 4f41c122c72dec3b860a1cabdb23536dbf18fbee /gcc/testsuite/gcc.dg/pr18596-2.c | |
parent | fedcccb5f9b79c9776b1429e3b4338e28efdef1f (diff) | |
download | gcc-61ba37bfdc89277570f40931fdfeb82dfefc5585.tar.gz |
2004-12-19 James A. Morrison <phython@gcc.gnu.org>
PR c/18596
* c-parse.in (initdcl): Don't process a declaration if start_decl fails.
(notype_initdcl): Don't process a declaration if start_decl fails.
* c-decl.c (start_decl): Fail if grokdeclarator fails.
(grokdeclarator): Fail if a function definition has an invalid storage
class.
* c-typeck.c (start_init): Treat error_mark_node the same as 0.
testsuite:
PR c/18596
* gcc.dg/funcdef-storage-1.c (foo): Remove.
* gcc.dg/pr18596-1.c: Use dg-error.
(dg-options): Use -fno-unit-at-a-time.
* gcc.dg/pr18596-2.c: New test.
* gcc.dg/pr18596-3.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92459 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr18596-2.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/pr18596-2.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr18596-2.c b/gcc/testsuite/gcc.dg/pr18596-2.c new file mode 100644 index 00000000000..7a52e807d38 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr18596-2.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-funit-at-a-time" } */ + +int f(int i) +{ + static int g(); /* { dg-error "invalid storage class" } */ + static int g() { return i; } /* { dg-error "invalid storage class" } */ + return g(); +} + +int k (int i) +{ + static int g (); /* { dg-error "invalid storage class" } */ + int g () { + return i; + } + + return g (); +} + +int l (int i) +{ + auto int g (); + static int g () { /* { dg-error "invalid storage class" } */ + return i; + } + + static int h () { /* { dg-error "invalid storage class" } */ + return 3; + } + return g () + h (); +} + +int m (int i) +{ + static g (); /* { dg-error "invalid storage class" } */ + static g () { return i; } /* { dg-error "invalid storage class" } */ + return g (); +} |