re PR c++/11670 (ICE in convert_like_real on illegal code)

cp:
	PR c++/11670
	* call.c (convert_like_real): Add rvalue binding error message.
	* error.c (dump_expr) <NOP_EXPR case>: Detect when the no expr is
	really a cast.
testsuite:
	PR c++/11670
	* g++.dg/expr/cast2.C: New test.

From-SVN: r70294
This commit is contained in:
Nathan Sidwell 2003-08-10 14:59:58 +00:00 committed by Nathan Sidwell
parent 86306a6b11
commit ffc7656178
4 changed files with 30 additions and 4 deletions

View File

@ -1,5 +1,10 @@
2003-08-10 Nathan Sidwell <nathan@codesourcery.com>
PR c++/11670
* call.c (convert_like_real): Add rvalue binding error message.
* error.c (dump_expr) <NOP_EXPR case>: Detect when the no expr is
really a cast.
PR c++/10530
* pt.c (dependent_type_p_r): A dependent template-id is a class
type with dependent template arguments, or a bound template

View File

@ -4133,7 +4133,7 @@ convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner,
error ("cannot bind packed field `%E' to `%T'",
expr, ref_type);
else
my_friendly_assert (0, 20030715);
error ("cannot bind rvalue `%E' to `%T'", expr, ref_type);
return error_mark_node;
}
expr = build_target_expr_with_type (expr, type);

View File

@ -1682,9 +1682,27 @@ dump_expr (tree t, int flags)
break;
case NOP_EXPR:
dump_expr (TREE_OPERAND (t, 0), flags);
break;
{
tree op = TREE_OPERAND (t, 0);
if (!same_type_p (TREE_TYPE (op), TREE_TYPE (t)))
{
/* It is a cast, but we cannot tell whether it is a
reinterpret or static cast. Use the C style notation. */
if (flags & TFF_EXPR_IN_PARENS)
pp_left_paren (cxx_pp);
pp_left_paren (cxx_pp);
dump_type (TREE_TYPE (t), flags);
pp_right_paren (cxx_pp);
dump_expr (op, flags | TFF_EXPR_IN_PARENS);
if (flags & TFF_EXPR_IN_PARENS)
pp_right_paren (cxx_pp);
}
else
dump_expr (op, flags);
break;
}
case EXPR_WITH_FILE_LOCATION:
dump_expr (EXPR_WFL_NODE (t), flags);
break;

View File

@ -1,5 +1,8 @@
2003-08-10 Nathan Sidwell <nathan@codesourcery.com>
PR c++/11670
* g++.dg/expr/cast2.C: New test.
PR c++/10530
* g++.dg/template/dependent-name2.C: New test.