diff options
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 3e1b44a..e55f1f9 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -6267,7 +6267,7 @@ finish_struct_1 (tree t) tree field = first_field (t); if (field == NULL_TREE || error_operand_p (field)) { - error ("type transparent class %qT does not have any fields", t); + error ("type transparent %q#T does not have any fields", t); TYPE_TRANSPARENT_AGGR (t) = 0; } else if (DECL_ARTIFICIAL (field)) @@ -6281,6 +6281,13 @@ finish_struct_1 (tree t) } TYPE_TRANSPARENT_AGGR (t) = 0; } + else if (TYPE_MODE (t) != DECL_MODE (field)) + { + error ("type transparent %q#T cannot be made transparent because " + "the type of the first field has a different ABI from the " + "class overall", t); + TYPE_TRANSPARENT_AGGR (t) = 0; + } } } |