OSDN Git Service

* c-typeck.c (output_init_element): Return early if value is
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 5 Nov 2004 22:21:30 +0000 (22:21 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 5 Nov 2004 22:21:30 +0000 (22:21 +0000)
error_mark_node.

testsuite:
* gcc.dg/init-undef-1.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@90146 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/init-undef-1.c [new file with mode: 0644]

index a1a60e7..749e21d 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-05  Joseph S. Myers  <joseph@codesourcery.com>
+
+       * c-typeck.c (output_init_element): Return early if value is
+       error_mark_node.
+
 2004-11-05  James E Wilson  <wilson@specifixinc.com>
 
        * invoke.texi (-fno-guess-branch-probability): Rewrite.
index 723bd5a..cf883b7 100644 (file)
@@ -5667,7 +5667,7 @@ static void
 output_init_element (tree value, bool strict_string, tree type, tree field,
                     int pending)
 {
-  if (type == error_mark_node)
+  if (type == error_mark_node || value == error_mark_node)
     {
       constructor_erroneous = 1;
       return;
index f27f80b..11071c9 100644 (file)
@@ -1,5 +1,9 @@
 2004-11-05  Joseph S. Myers  <joseph@codesourcery.com>
 
+       * gcc.dg/init-undef-1.c: New test.
+
+2004-11-05  Joseph S. Myers  <joseph@codesourcery.com>
+
        * gcc.dg/20040910-1.c, gcc.dg/cpp/digraph2.c,
        gcc.dg/cpp/direct2.c, gcc.dg/cpp/direct2s.c,
        gcc.dg/cpp/separate-1.c, gcc.dg/noncompile/951123-1.c,
diff --git a/gcc/testsuite/gcc.dg/init-undef-1.c b/gcc/testsuite/gcc.dg/init-undef-1.c
new file mode 100644 (file)
index 0000000..b775889
--- /dev/null
@@ -0,0 +1,8 @@
+/* Invalid initializers should not receive an "is not constant"
+   error.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+int p = c; /* { dg-error "undeclared" } */
+struct s { int a; } x = { b }; /* { dg-error "undeclared" } */