Commit fc40d49c by Lee Millward Committed by Lee Millward

re PR c++/19439 (Duplicate destructor accepted)

       PR c++/19439
       * class.c (add_method): Don't wait until template
       instantiation time to complain about duplicate methods.

       * g++.dg/template/duplicate1.C: New test
       * g++.dg/template/memfriend6.C: Adjust error markers.

From-SVN: r120520
parent 70973361
2007-01-06 Lee Millward <lee.millward@codesourcery.com>
PR c++/19439
* class.c (add_method): Don't wait until template
instantiation time to complain about duplicate methods.
2007-01-05 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c/19978
......
/* Functions related to building classes and their related objects.
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC.
......@@ -898,6 +899,7 @@ add_method (tree type, tree method, tree using_decl)
bool complete_p;
bool insert_p = false;
tree current_fns;
tree fns;
if (method == error_mark_node)
return false;
......@@ -975,14 +977,6 @@ add_method (tree type, tree method, tree using_decl)
}
current_fns = insert_p ? NULL_TREE : VEC_index (tree, method_vec, slot);
if (processing_template_decl)
/* TYPE is a template class. Don't issue any errors now; wait
until instantiation time to complain. */
;
else
{
tree fns;
/* Check to see if we've already got this method. */
for (fns = current_fns; fns; fns = OVL_NEXT (fns))
{
......@@ -1062,7 +1056,6 @@ add_method (tree type, tree method, tree using_decl)
return false;
}
}
}
/* A class should never have more than one destructor. */
if (current_fns && DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (method))
......
2006-01-06 Lee Millward <lee.millward@codesourcery.com>
PR c++/19439
* g++.dg/template/duplicate1.C: New test
* g++.dg/template/memfriend6.C: Adjust error markers.
2007-01-05 Andrew Pinski <Andrew_Pinski@playstation.sony.com>
PR tree-opt/30385
//PR c++/19439
template<int> struct A
{
~A() {} // { dg-error "with" }
~A() {} // { dg-error "cannot be overloaded" }
};
......@@ -8,8 +8,8 @@
template <class T> struct A {
template <class U> void f(U); // { dg-error "candidate" }
void g(); // { dg-error "candidate" }
void h(); // { dg-error "candidate" }
void g(); // { dg-error "candidate|with" }
void h(); // { dg-error "candidate|with" }
void i(int); // { dg-error "candidate" }
};
......@@ -17,7 +17,7 @@ class C {
int ii;
template <class U> friend void A<U>::f(U); // { dg-error "not match" }
template <class U> template <class V>
friend void A<U>::g(); // { dg-error "not match" }
template <class U> friend int A<U>::h(); // { dg-error "not match" }
friend void A<U>::g(); // { dg-error "not match|cannot be overloaded" }
template <class U> friend int A<U>::h(); // { dg-error "not match|cannot be overloaded" }
template <class U> friend void A<U>::i(char); // { dg-error "not match" }
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment