Commit e5d9235b by Marek Polacek Committed by Marek Polacek

re PR c/65050 (Show the type for "array type has incomplete element type" error)

	PR c/65050
	* c-decl.c (grokdeclarator): Print also the type when giving
	the error message about array's incomplete element type.

	* gcc.dg/pr65050.c: New test.

From-SVN: r220698
parent ef796bef
2015-02-13 Marek Polacek <polacek@redhat.com>
PR c/65050
* c-decl.c (grokdeclarator): Print also the type when giving
the error message about array's incomplete element type.
2015-02-11 Jakub Jelinek <jakub@redhat.com>
PR c/64824
......
......@@ -5962,7 +5962,8 @@ grokdeclarator (const struct c_declarator *declarator,
/* Complain about arrays of incomplete types. */
if (!COMPLETE_TYPE_P (type))
{
error_at (loc, "array type has incomplete element type");
error_at (loc, "array type has incomplete element type %qT",
type);
type = error_mark_node;
}
else
......
2015-02-13 Marek Polacek <polacek@redhat.com>
PR c/65050
* gcc.dg/pr65050.c: New test.
2015-02-13 Jeff Law <law@redhat.com>
PR tree-optimization/64823
......
/* PR c/65050 */
/* { dg-do compile } */
typedef int A[];
struct S { int i; A a[5]; } s; /* { dg-error "array type has incomplete element type .A {aka int\\\[\\\]}." } */
extern void foo (int p[2][]); /* { dg-error "array type has incomplete element type .int\\\[\\\]." } */
extern void bar (A p[2]); /* { dg-error "array type has incomplete element type .A {aka int\\\[\\\]}." } */
void
foo (int p[2][]) /* { dg-error "array type has incomplete element type .int\\\[\\\]." } */
{
}
void
bar (A p[2]) /* { dg-error "array type has incomplete element type .A {aka int\\\[\\\]}." } */
{
}
struct T;
struct T t[5]; /* { dg-error "array type has incomplete element type .struct T." } */
struct U u[] = { { "abc" } }; /* { dg-error "array type has incomplete element type .struct U." } */
typedef struct T TT;
TT tt[5]; /* { dg-error "array type has incomplete element type .TT {aka struct T}." } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment