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]

[patch] Fix PR c++/19439


Hi,

This bug is an accepts-invalid with the following testcase:

template<int> struct A
{
 ~A() {}
 ~A() {}
};

The reason for this code being accepted can be tracked down to the
following comment in add_method(): "TYPE is a template class.  Don't
issue any errors now; wait until instantiation time to complain", the
problem being in this case the template isn't instantiated so no
diagnostic is issued.

The attached patch fixes this bug by not waiting until a template is
instantiated to issue errors about duplicate methods, thereby causing
the above testcase to be rejected.

Bootstrapped and regression tested on i686-pc-linux-gnu with no new
failures. Ok for mainline?

Cheers,
Lee.

:ADDPATCH c++:

cp/
2006-12-21  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.

testsuite/
2006-12-21  Lee Millward  <lee.millward@codesourcery.com>

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

Attachment: pr19439.txt
Description: Text document


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