re PR c/35437 (ICE with struct containing incomplete type)

gcc/

2008-10-07  Simon Martin  <simartin@users.sourceforge.net>
        
        PR c/35437
        * expr.c (count_type_elements): Handle ERROR_MARK.

gcc/testsuite/

2008-01-07  Simon Martin  <simartin@users.sourceforge.net>

        PR c/35437
        * gcc.dg/struct-parse-2.c: New test.
        * g++.dg/parse/struct-4.C: New test.

From-SVN: r140953
This commit is contained in:
Simon Martin 2008-10-07 20:56:53 +00:00 committed by Simon Martin
parent 3b14bb3928
commit 16d5ffec52
5 changed files with 40 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2008-10-07 Simon Martin <simartin@users.sourceforge.net>
PR c/35437
* expr.c (count_type_elements): Handle ERROR_MARK.
2008-10-07 Jakub Jelinek <jakub@redhat.com>
PR debug/29609

View File

@ -5021,6 +5021,9 @@ count_type_elements (const_tree type, bool allow_flexarr)
case REFERENCE_TYPE:
return 1;
case ERROR_MARK:
return 0;
case VOID_TYPE:
case METHOD_TYPE:
case FUNCTION_TYPE:

View File

@ -1,3 +1,9 @@
2008-10-07 Simon Martin <simartin@users.sourceforge.net>
PR c/35437
* gcc.dg/struct-parse-2.c: New test.
* g++.dg/parse/struct-4.C: New test.
2008-10-07 Jakub Jelinek <jakub@redhat.com>
PR debug/29609

View File

@ -0,0 +1,13 @@
/* PR c/35437 */
/* { dg-do "compile" } */
struct A
{
int i;
struct A a; /* { dg-error "has incomplete type" } */
};
void foo()
{
struct A b = { 0 };
}

View File

@ -0,0 +1,13 @@
/* PR c/35437 */
/* { dg-do "compile" } */
struct A
{
int i;
struct A a; /* { dg-error "has incomplete type" } */
};
void foo()
{
struct A b = { 0 };
}