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
This commit is contained in:
Nathan Sidwell 2003-03-21 15:42:36 +00:00 committed by Nathan Sidwell
parent 526278c97f
commit f3146d75a9
4 changed files with 40 additions and 4 deletions

View File

@ -1,3 +1,9 @@
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>
* cp/decl2.c (arg_assoc_class): Correct check for namespace-scope

View File

@ -971,7 +971,7 @@ dump_decl (tree t, int flags)
else if (DECL_INITIAL (t))
dump_expr (DECL_INITIAL (t), flags | TFF_EXPR_IN_PARENS);
else
print_identifier (scratch_buffer, "enumerator");
print_identifier (scratch_buffer, "<enumerator>");
break;
case USING_DECL:
@ -1844,9 +1844,19 @@ dump_expr (tree t, int flags)
}
}
}
if (TREE_TYPE (t) && !CONSTRUCTOR_ELTS (t))
{
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;
case OFFSET_REF:

View File

@ -1,3 +1,8 @@
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>
* g++.dg/template/friend17.C: New test.

View File

@ -0,0 +1,15 @@
// { 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" "" }
}