re PR c++/10527 (confused error message with "new int()" parameter initializer)

PR c++/10527
	* error.c (dump_expr): Correctly handling of NEW_EXPR.4

	PR c++/10527
	* g++.dg/init/new7.C: New test.

From-SVN: r66247
This commit is contained in:
Mark Mitchell 2003-04-29 20:17:00 +00:00 committed by Mark Mitchell
parent cc9d1c78ef
commit 60cde93696
4 changed files with 28 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2003-04-29 Mark Mitchell <mark@codesourcery.com>
PR c++/10527
* error.c (dump_expr): Correctly handling of NEW_EXPR.4
2003-04-29 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* call.c (build_operator_new_call): Fix typo.

View File

@ -1603,6 +1603,7 @@ dump_expr (tree t, int flags)
case NEW_EXPR:
{
tree type = TREE_OPERAND (t, 1);
tree init = TREE_OPERAND (t, 2);
if (NEW_EXPR_USE_GLOBAL (t))
print_scope_operator (scratch_buffer);
output_add_string (scratch_buffer, "new ");
@ -1619,10 +1620,17 @@ dump_expr (tree t, int flags)
TREE_OPERAND (type, 1),
integer_one_node))));
dump_type (type, flags);
if (TREE_OPERAND (t, 2))
if (init)
{
print_left_paren (scratch_buffer);
dump_expr_list (TREE_OPERAND (t, 2), flags);
if (TREE_CODE (init) == TREE_LIST)
dump_expr_list (init, flags);
else if (init == void_zero_node)
/* This representation indicates an empty initializer,
e.g.: "new int()". */
;
else
dump_expr (init, flags);
print_right_paren (scratch_buffer);
}
}

View File

@ -1,7 +1,12 @@
2003-04-29 Mark Mitchell <mark@codesourcery.com>
PR c++/10527
* g++.dg/init/new7.C: New test.
2003-04-29 Mark Mitchell <mark@codesourcery.com>
* g++.dg/ext/desig1.C: New test.
* g++.dg/ext/init1.C: Likewise.
* g++.dg/ext/init1.C: Update.
* g++.old-deja/g++.pt/deduct5.C: Remove unnecessary initializer.

View File

@ -0,0 +1,7 @@
template <class T>
struct Foo
{};
template <class T>
void Foo<T>::NON_EXISTENT(int* val = new int()) {} // { dg-error "" }