public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/4411: g++ 3.0 doesn't find matching template function
@ 2002-02-26 14:47 nathan
  0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2002-02-26 14:47 UTC (permalink / raw)
  To: cppx, gcc-bugs, gcc-prs, nobody

Synopsis: g++ 3.0 doesn't find matching template function

State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Tue Feb 26 14:27:40 2002
State-Changed-Why:
    fixed in current CVS so 3.1 will be ok

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4411


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

* c++/4411: g++ 3.0 doesn't find matching template function
@ 2001-09-27  7:36 cppx
  0 siblings, 0 replies; 2+ messages in thread
From: cppx @ 2001-09-27  7:36 UTC (permalink / raw)
  To: gcc-gnats

>Number:         4411
>Category:       c++
>Synopsis:       g++ 3.0 doesn't find matching template function
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 27 07:36:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Malton
>Release:        gcc version 3.0
>Organization:
University of Waterloo
>Environment:
System: Linux swag.uwaterloo.ca 2.2.17 #2 SMP Thu Dec 14 20:12:03 EST 2000 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.0/configure --prefix=/home/cppx/gcc-3.0/install/
>Description:
	A situation arises in which g++ fails to find a matching function call.
	It apparently requires the interaction of
	(a) template function
	(b) with template argument which is a function type
	(c) and with pointer to member parameter
	In so far as removing the template header, changing the template argument to a 
	data type, or changing the parameter to something which isn't a pointer-to-member,
	make the problem go away (i.e. the same code is accepted).

	The error is "no matching function for call to `f (int (B::*)())".

>How-To-Repeat:
	The following code illustrates the problem:

	typedef int T ();
	struct B {T h;};
	template <class T> void f (T B::*);
	void g () { f<T> (&B::h); }

	(But removing the template works fine, as in

	typedef int T ();
	struct B {T h;};
	void f (T B::*);
	void g () { f (&B::h); }

	(and using a data type instead of a function type for T works fine, as in

	typedef int (*T) ();
	struct B {T h;};
	template <class T> void f (T B::*);
	void g () { f<T> (&B::h); }

	(and dropping the pointer-to-member works fine, as in

	typedef int T ();
	T h;
	template <class T> void f (T*);
	void g () { f<T> (&h); }

	(and I hope this pinpoints the issue, assuming it isn't all an obscure infraction.)



>Fix:
	The easiest workaround is not instantiating f with a function type, but use a pointer to 
	function type instead.  
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-02-26 22:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-26 14:47 c++/4411: g++ 3.0 doesn't find matching template function nathan
  -- strict thread matches above, loose matches on Subject: below --
2001-09-27  7:36 cppx

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