Problem with templates used in a class member.

Jason Merrill jason@cygnus.com
Tue Sep 8 23:43:00 GMT 1998


>>>>> Ram'on Garc'ia <ramon@jl1.quim.ucm.es> writes:

 > On Fri, 4 Sep 1998, Carlo Wood wrote:
 >> (You forgot a '&' in front of fn)
 >> I *think* that this is not a limitation of egcs...
 >> Consider:
 >> 
 >> template <class P, void (P::*member)()>
 >> class x { };
 >> 
 >> class user {
 >> public:
 >>         user() {}
 >> 	void fn() {}
 >> 	x<user, &user::fn> a;
 >> };

 > I am not a C++ guru; however, it is usual in both C and C++ that you can
 > leave out the & sign for pointers to functions.

Yes, but not for pointers to member functions.  This is a deliberate
difference.

 > I do not have a copy of the C++ standard; I can read the 1996 working
 > paper. Therefore, I usually relay on EDG based compilers, since this
 > frontend was written by members of the C++ ANSI/ISO commitee.

Well, so is g++.  So are all the other C++ compilers.  EDG is definitely
one of the better compilers, tho.

Jason



More information about the Gcc mailing list