re PR c++/53761 (ICE on incorrect transparent union (first field has floating point type))

/cp
2012-10-25  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/53761
	* class.c (finish_struct_1): Reject aggregates decorated with
	__transparent_union__ which cannot be made transparent because
	the type of the first field has a different ABI from the class
	overall.

/testsuite
2012-10-25  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/53761
	* g++.dg/ext/transparent-union.C: New.

From-SVN: r192814
This commit is contained in:
Paolo Carlini 2012-10-25 16:14:59 +00:00 committed by Paolo Carlini
parent f14edc1af5
commit 42b40eff80
4 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2012-10-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/53761
* class.c (finish_struct_1): Reject aggregates decorated with
__transparent_union__ which cannot be made transparent because
the type of the first field has a different ABI from the class
overall.
2012-10-25 Jason Merrill <jason@redhat.com>
Core 1402

View File

@ -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;
}
}
}

View File

@ -1,3 +1,8 @@
2012-10-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/53761
* g++.dg/ext/transparent-union.C: New.
2012-10-25 Marc Glisse <marc.glisse@inria.fr>
PR c++/54427

View File

@ -0,0 +1,5 @@
// PR c++/53761
typedef union { // { dg-error "type transparent" }
double x;
} __attribute__(( __transparent_union__ )) example_t;