This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[C++ PATCH]: Fix bug 1606


Hi,
I've installed this obvious patch which fixes a thinko emitting an
error message for bug 1606.

built & tested on i686-pc-linux-gnu

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2001-01-10  Nathan Sidwell  <nathan@codesourcery.com>

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

Index: cp/error.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/error.c,v
retrieving revision 1.147
diff -c -3 -p -r1.147 error.c
*** error.c	2000/12/21 17:50:07	1.147
--- error.c	2001/01/10 15:32:48
*************** dump_template_parameter (parm, flags)
*** 336,342 ****
    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)
          dump_type (a, flags & ~TFF_CHASE_TYPEDEF);
        else
          dump_expr (a, flags | TFF_EXPR_IN_PARENS);
--- 336,342 ----
    if ((flags & TFF_FUNCTION_DEFAULT_ARGUMENTS) && a != NULL_TREE)
      {
        output_add_string (scratch_buffer, " = ");
!       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);
// 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
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]