summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr18596-3.c
diff options
context:
space:
mode:
authorphython <phython@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-21 17:01:08 +0000
committerphython <phython@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-21 17:01:08 +0000
commit61ba37bfdc89277570f40931fdfeb82dfefc5585 (patch)
tree4f41c122c72dec3b860a1cabdb23536dbf18fbee /gcc/testsuite/gcc.dg/pr18596-3.c
parentfedcccb5f9b79c9776b1429e3b4338e28efdef1f (diff)
downloadgcc-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-3.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr18596-3.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr18596-3.c b/gcc/testsuite/gcc.dg/pr18596-3.c
new file mode 100644
index 00000000000..be17e7ca4b3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr18596-3.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+int foo ()
+{
+ static g () = 0; /* { dg-error "invalid storage class" } */
+ static int f () = 1; /* { dg-error "invalid storage class" } */
+ auto int h () = 0; /* { dg-error "initialized like a variable" } */
+ static int i () = { 0 }; /* { dg-error "invalid storage class" } */
+ static int j () = /* { dg-error "invalid storage class" } */
+ { 0, 0.0 };
+}
+/* { dg-warning "excess elements" "" { target *-*-* } 11 } */
+/* { dg-warning "near initialization" "" { target *-*-* } 11 } */