From 31bb3027a6ebbaa77b0d159f792a8fa9147b8841 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Wed, 10 Jan 2001 15:41:00 +0000 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/error.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.old-deja/g++.pt/error3.C | 18 ++++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/error3.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6146404b21e..c10022c6778 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2001-01-10 Nathan Sidwell + + * error.c (dump_template_parameter): Use parm to determine how + to print default value. + 2001-01-10 Nathan Sidwell * class.c (duplicate_tag_error): Clear more flags. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index ce11ae1eda8..5ecdab71fed 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c4ae1e2f917..8c95265f817 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-01-10 Nathan Sidwell + + * g++.old_deja/g++.pt/error3.C: New test. + 2001-01-10 Nathan Sidwell * g++.old_deja/g++.other/crash39.C: New test. diff --git a/gcc/testsuite/g++.old-deja/g++.pt/error3.C b/gcc/testsuite/g++.old-deja/g++.pt/error3.C new file mode 100644 index 00000000000..60a2ad5f59a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/error3.C @@ -0,0 +1,18 @@ +// Build don't link: + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 10 Jan 2001 + +// Bug 1606. We sorry'd issuing an error. + +struct A {}; +template class Tpl {}; + +struct B { + Tpl s; +}; + +void foo (B *ptr) +{ + ptr->Tpl.t (); // ERROR - template as expression +}