aboutsummaryrefslogtreecommitdiff
path: root/gcc/convert.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-08-30 16:04:17 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-08-30 16:04:17 +0000
commit9c4cb3a3e9b59142d107270aa7c32e920c43c66b (patch)
tree45ab1790c433559aaf5d675f3428236d151327b3 /gcc/convert.c
parent3103b7db046c4cab73db41a6be14b410c3473a37 (diff)
downloadgcc-9c4cb3a3e9b59142d107270aa7c32e920c43c66b.zip
gcc-9c4cb3a3e9b59142d107270aa7c32e920c43c66b.tar.gz
gcc-9c4cb3a3e9b59142d107270aa7c32e920c43c66b.tar.bz2
convert.c (convert_to_integer): Issue an error on conversions to incomplete types.
* convert.c (convert_to_integer): Issue an error on conversions to incomplete types. From-SVN: r22102
Diffstat (limited to 'gcc/convert.c')
-rw-r--r--gcc/convert.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/convert.c b/gcc/convert.c
index e03d39b..bfcb5db 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -121,6 +121,14 @@ convert_to_integer (type, expr)
int inprec = TYPE_PRECISION (intype);
int outprec = TYPE_PRECISION (type);
+ /* An INTEGER_TYPE cannot be incomplete, but an ENUMERAL_TYPE can
+ be. Consider `enum E = { a, b = (enum E) 3 };'. */
+ if (!TYPE_SIZE (type))
+ {
+ error ("conversion to incomplete type");
+ return error_mark_node;
+ }
+
switch (TREE_CODE (intype))
{
case POINTER_TYPE: