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]
Other format: [Raw text]

[C++ PATCH]: Fix pr 7768


Hi,
I've installed this obvious patch for 7768. A pretty_function failure.

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

2002-09-14  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/7768
	* pt.c (build_template_decl): Copy DECL_DESTRUCTOR_P.

Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.612
diff -c -3 -p -r1.612 pt.c
*** cp/pt.c	13 Sep 2002 21:47:20 -0000	1.612
--- cp/pt.c	14 Sep 2002 19:52:55 -0000
*************** build_template_decl (decl, parms)
*** 2110,2115 ****
--- 2110,2116 ----
  	DECL_VIRTUAL_CONTEXT (tmpl) = DECL_VIRTUAL_CONTEXT (decl);
        DECL_STATIC_FUNCTION_P (tmpl) = DECL_STATIC_FUNCTION_P (decl);
        DECL_CONSTRUCTOR_P (tmpl) = DECL_CONSTRUCTOR_P (decl);
+       DECL_DESTRUCTOR_P (tmpl) = DECL_DESTRUCTOR_P (decl);
        DECL_NONCONVERTING_P (tmpl) = DECL_NONCONVERTING_P (decl);
        DECL_ASSIGNMENT_OPERATOR_P (tmpl) = DECL_ASSIGNMENT_OPERATOR_P (decl);
        if (DECL_OVERLOADED_OPERATOR_P (decl))
// { dg-do run }

// Copyright (C) 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Sep 2002 <nathan@codesourcery.com>

// PR 7768 template dtor pretty function wrong

#include <string.h>

static size_t current = 0;
static bool error = false;

static char const *names[] =
{
  "X<T>::X() [with T = void]",
  "X<T>::~X() [with T = void]",
  0
};

void Verify (char const *ptr)
{
  error = strcmp (ptr, names[current++]);
}
  
template <typename T>
struct X
{
  X() { Verify (__PRETTY_FUNCTION__); }
  ~X() { Verify (__PRETTY_FUNCTION__); }
};

int main()
{
  {
    X<void> x;
    
    if (error)
      return current;
  }
  if (error)
    return current;
  return 0;
}

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