re PR c++/47041 (Internal compiler error in build_data_member_initialization, add cp/semantics.c:5483)

PR c++/47041
	* semantics.c (build_constexpr_constructor_member_initializers):
	Handle trivial copy.

From-SVN: r169108
This commit is contained in:
Jason Merrill 2011-01-21 17:30:26 -05:00 committed by Jason Merrill
parent 12c30f2fba
commit 62f9aedcd0
4 changed files with 34 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2011-01-21 Jason Merrill <jason@redhat.com>
PR c++/47041
* semantics.c (build_constexpr_constructor_member_initializers):
Handle trivial copy.
2011-01-21 Jakub Jelinek <jakub@redhat.com>
PR c++/47388

View File

@ -5607,7 +5607,20 @@ build_constexpr_constructor_member_initializers (tree type, tree body)
body = STATEMENT_LIST_HEAD (body)->stmt;
body = BIND_EXPR_BODY (body);
if (TREE_CODE (body) == CLEANUP_POINT_EXPR)
ok = build_data_member_initialization (body, &vec);
{
body = TREE_OPERAND (body, 0);
if (TREE_CODE (body) == EXPR_STMT)
body = TREE_OPERAND (body, 0);
if (TREE_CODE (body) == INIT_EXPR
&& (same_type_ignoring_top_level_qualifiers_p
(TREE_TYPE (TREE_OPERAND (body, 0)),
current_class_type)))
{
/* Trivial copy. */
return TREE_OPERAND (body, 1);
}
ok = build_data_member_initialization (body, &vec);
}
else if (TREE_CODE (body) == STATEMENT_LIST)
{
tree_stmt_iterator i;

View File

@ -1,3 +1,8 @@
2011-01-21 Jason Merrill <jason@redhat.com>
PR c++/47041
* g++.dg/cpp0x/constexpr-ctor6.C: New.
2011-01-21 Jakub Jelinek <jakub@redhat.com>
PR c++/47388

View File

@ -0,0 +1,9 @@
// PR c++/47041
// { dg-options "-std=c++0x -fno-elide-constructors" }
struct S
{
int i;
};
S s = S ();