summaryrefslogtreecommitdiff
path: root/gcc/c-convert.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-convert.c')
-rw-r--r--gcc/c-convert.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/c-convert.c b/gcc/c-convert.c
index 582ec8bfe34..3067137c372 100644
--- a/gcc/c-convert.c
+++ b/gcc/c-convert.c
@@ -114,6 +114,9 @@ convert (tree type, tree expr)
return fold (convert_to_complex (type, e));
if (code == VECTOR_TYPE)
return fold (convert_to_vector (type, e));
+ if ((code == RECORD_TYPE || code == UNION_TYPE)
+ && lang_hooks.types_compatible_p (type, TREE_TYPE (expr)))
+ return e;
error ("conversion to non-scalar type requested");
return error_mark_node;