diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-08-30 16:04:17 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-08-30 16:04:17 +0000 |
commit | a28ac7231e890e31d2a773dee95d2604a6756cfb (patch) | |
tree | 45ab1790c433559aaf5d675f3428236d151327b3 /gcc/convert.c | |
parent | c3cc26e151d49811fa06833412c5a4e8ebc334da (diff) | |
download | gcc-a28ac7231e890e31d2a773dee95d2604a6756cfb.tar.gz |
* convert.c (convert_to_integer): Issue an error on conversions to
incomplete types.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22102 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/convert.c')
-rw-r--r-- | gcc/convert.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/convert.c b/gcc/convert.c index e03d39b7f32..bfcb5db4470 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: |