error.c (dump_template_parameter): Use parm to determine how to print default value.

cp:
	* error.c (dump_template_parameter): Use parm to determine how
	to print default value.
testsuite:
	* g++.old_deja/g++.pt/error3.C: New test.

From-SVN: r38869
This commit is contained in:
Nathan Sidwell 2001-01-10 15:41:00 +00:00 committed by Nathan Sidwell
parent c0c102a96b
commit 31bb3027a6
4 changed files with 28 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2001-01-10 Nathan Sidwell <nathan@codesourcery.com>
* error.c (dump_template_parameter): Use parm to determine how
to print default value.
2001-01-10 Nathan Sidwell <nathan@codesourcery.com>
* class.c (duplicate_tag_error): Clear more flags.

View File

@ -336,7 +336,7 @@ dump_template_parameter (parm, flags)
if ((flags & TFF_FUNCTION_DEFAULT_ARGUMENTS) && a != NULL_TREE)
{
output_add_string (scratch_buffer, " = ");
if (TREE_CODE (a) == TYPE_DECL || TREE_CODE (a) == TEMPLATE_DECL)
if (TREE_CODE (p) == TYPE_DECL || TREE_CODE (p) == TEMPLATE_DECL)
dump_type (a, flags & ~TFF_CHASE_TYPEDEF);
else
dump_expr (a, flags | TFF_EXPR_IN_PARENS);

View File

@ -1,3 +1,7 @@
2001-01-10 Nathan Sidwell <nathan@codesourcery.com>
* g++.old_deja/g++.pt/error3.C: New test.
2001-01-10 Nathan Sidwell <nathan@codesourcery.com>
* g++.old_deja/g++.other/crash39.C: New test.

View File

@ -0,0 +1,18 @@
// Build don't link:
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 10 Jan 2001 <nathan@codesourcery.com>
// Bug 1606. We sorry'd issuing an error.
struct A {};
template <class T = A> class Tpl {};
struct B {
Tpl<int> s;
};
void foo (B *ptr)
{
ptr->Tpl.t (); // ERROR - template as expression
}