This is the mail archive of the gcc@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]

Re: using decls and template methods




--On Wednesday, October 16, 2002 09:24:06 PM +0100 Nathan Sidwell <nathan@codesourcery.com> wrote:

Hi,
PR 7676 concerns the overloading of template methods of the form
	struct A {
		template <class T> void Foo ();
		template <int I> void Foo ();
	};
we erroneously reject this. However, the relevent bit of cp/class.c also
deals with using decls. Consider
	struct A {
		template <class T> void Foo ();
	};
	struct B : A {
		template <int I> void Foo ();
		using A::Foo;
	};
is A::Foo overridden or not? (and what if one is a template and the
other not?)
I think that Foo is overloaded in B.  (I assume you mean "overloaded" and
not "overridden".)

[7.3.3]/12 says base functions with the same name and parameter types are
overridden. It does not mention 'and same template parameters'.

[13.1]/2 does explicitly mention that the template parameters must also
be the same. (2nd bullet)
Only if one of the functions is static; in this case neither is static.

--
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com


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