aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-06-12 23:16:20 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2012-06-12 23:16:20 +0200
commitcce5086157debf5d546591cc8f48a4dd95fd108b (patch)
treee993739bf8bc3a9a389b46900f9bbbceaa67308b /gcc/c-decl.c
parent9690ac05c92a154b5d2ca7078d3bf6f4c7eb6c57 (diff)
downloadgcc-cce5086157debf5d546591cc8f48a4dd95fd108b.zip
gcc-cce5086157debf5d546591cc8f48a4dd95fd108b.tar.gz
gcc-cce5086157debf5d546591cc8f48a4dd95fd108b.tar.bz2
re PR c/53532 (function call ignored when called with argument of incompatible, undefined structure)
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. From-SVN: r188483
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 1b51d21..86add14 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);