summaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-12 21:16:20 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-12 21:16:20 +0000
commit4269c49ca94653f84fd5a5f4f5ed9ac4b9822869 (patch)
treee993739bf8bc3a9a389b46900f9bbbceaa67308b /gcc/c-decl.c
parentb3e2a6c9a7ee815324c4902eb65f75152989ad61 (diff)
downloadgcc-4269c49ca94653f84fd5a5f4f5ed9ac4b9822869.tar.gz
PR c/53532
PR c/51034 PR c/53196 * c-decl.c (build_compound_literal): Call c_incomplete_type_error if type isn't complete. * gcc.dg/pr53532.c: New test. * gcc.dg/c99-complit-2.c: Add two new dg-error directives, adjust line numbers. * gcc.dg/noncompile/950825-1.c: Expect incomplete type error message. * gcc.dg/Wcxx-compat-8.c: Likewise. * gcc.dg/pr51034.c: New test. * gcc.dg/pr53196-1.c: New test. * gcc.dg/pr53196-2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188483 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 1b51d219c58..86add1402b4 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -4637,7 +4637,10 @@ build_compound_literal (location_t loc, tree type, tree init, bool non_const)
}
if (type == error_mark_node || !COMPLETE_TYPE_P (type))
- return error_mark_node;
+ {
+ c_incomplete_type_error (NULL_TREE, type);
+ return error_mark_node;
+ }
stmt = build_stmt (DECL_SOURCE_LOCATION (decl), DECL_EXPR, decl);
complit = build1 (COMPOUND_LITERAL_EXPR, type, stmt);