From 9c4cb3a3e9b59142d107270aa7c32e920c43c66b Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Sun, 30 Aug 1998 16:04:17 +0000 Subject: 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 --- gcc/ChangeLog | 5 +++++ gcc/convert.c | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7d8dd73..67b14e6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Sun Aug 30 16:05:45 1998 Mark Mitchell + + * convert.c (convert_to_integer): Issue an error on conversions to + incomplete types. + Sun Aug 30 16:47:20 1998 Martin von Lvwis * Makefile.in: Add lang_tree_files and gencheck.h. 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: -- cgit v1.1