Commit 60cde936 by Mark Mitchell Committed by Mark Mitchell

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
parent cc9d1c78
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.
......
......@@ -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);
}
}
......
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.
......
template <class T>
struct Foo
{};
template <class T>
void Foo<T>::NON_EXISTENT(int* val = new int()) {} // { dg-error "" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment