Commit f3146d75 by Nathan Sidwell Committed by Nathan Sidwell

re PR c++/9898 (Template reference cast operator of template class)

cp:
	PR c++/9898
	* error.c (dump_decl) [CONST_DECL]: Print '<enumerator>'.
	(dump_expr) [CONSTRUCTOR]: Print default ctor as a function call.
testsuite:
	PR c++/9898
	* g++.dg/other/error4.C: New test.

From-SVN: r64667
parent 526278c9
2003-03-21 Nathan Sidwell <nathan@codesourcery.com>
PR c++/9898
* error.c (dump_decl) [CONST_DECL]: Print '<enumerator>'.
(dump_expr) [CONSTRUCTOR]: Print default ctor as a function call.
2003-03-20 Mark Mitchell <mark@codesourcery.com> 2003-03-20 Mark Mitchell <mark@codesourcery.com>
* cp/decl2.c (arg_assoc_class): Correct check for namespace-scope * cp/decl2.c (arg_assoc_class): Correct check for namespace-scope
......
...@@ -971,7 +971,7 @@ dump_decl (tree t, int flags) ...@@ -971,7 +971,7 @@ dump_decl (tree t, int flags)
else if (DECL_INITIAL (t)) else if (DECL_INITIAL (t))
dump_expr (DECL_INITIAL (t), flags | TFF_EXPR_IN_PARENS); dump_expr (DECL_INITIAL (t), flags | TFF_EXPR_IN_PARENS);
else else
print_identifier (scratch_buffer, "enumerator"); print_identifier (scratch_buffer, "<enumerator>");
break; break;
case USING_DECL: case USING_DECL:
...@@ -1844,9 +1844,19 @@ dump_expr (tree t, int flags) ...@@ -1844,9 +1844,19 @@ dump_expr (tree t, int flags)
} }
} }
} }
output_add_character (scratch_buffer, '{'); if (TREE_TYPE (t) && !CONSTRUCTOR_ELTS (t))
dump_expr_list (CONSTRUCTOR_ELTS (t), flags); {
output_add_character (scratch_buffer, '}'); dump_type (TREE_TYPE (t), 0);
output_add_character (scratch_buffer, '(');
output_add_character (scratch_buffer, ')');
}
else
{
output_add_character (scratch_buffer, '{');
dump_expr_list (CONSTRUCTOR_ELTS (t), flags);
output_add_character (scratch_buffer, '}');
}
break; break;
case OFFSET_REF: case OFFSET_REF:
......
2003-03-21 Nathan Sidwell <nathan@codesourcery.com>
PR c++/9898
* g++.dg/other/error4.C: New test.
2003-03-20 Mark Mitchell <mark@codesourcery.com> 2003-03-20 Mark Mitchell <mark@codesourcery.com>
* g++.dg/template/friend17.C: New test. * g++.dg/template/friend17.C: New test.
......
// { dg-do compile }
// Copyright (C) 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 21 Mar 2003 <nathan@codesourcery.com>
// PR 9898. Confusing error message
struct Wrapper {};
void Foo(int const &); // { dg-error "in passing" "" }
void Baz ()
{
Foo (Wrapper ()); // { dg-error "convert `Wrapper *\\(\\)' to" "" }
}
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