public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* using decls and template methods
@ 2002-10-16 14:13 Nathan Sidwell
  2002-10-16 16:40 ` Mark Mitchell
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Sidwell @ 2002-10-16 14:13 UTC (permalink / raw)
  To: gcc; +Cc: mark, jason, gdr

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?)

[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)

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: using decls and template methods
  2002-10-16 14:13 using decls and template methods Nathan Sidwell
@ 2002-10-16 16:40 ` Mark Mitchell
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Mitchell @ 2002-10-16 16:40 UTC (permalink / raw)
  To: Nathan Sidwell, gcc; +Cc: jason, gdr



--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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-10-16 22:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-16 14:13 using decls and template methods Nathan Sidwell
2002-10-16 16:40 ` Mark Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).