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

[Bug c++/10126] ICE in convert_nontype_argument on using overload resolution in template args


------- Additional Comments From marco dot franzen at bigfoot dot com  2003-12-11 21:55 -------
Subject: Re:  ICE in convert_nontype_argument on using overload resolution in template args

I have bootstrapped gcc-3.4-20031203, and the crash is indeed fixed.
Thanks a lot to everyone!

Jason, you write in c9
       http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10126#c9

> For better or worse, in this case worse, &Strawberry::I has type
> pointer to member function of Fruit, not of Strawberry, and no
> conversion is done to make it a pointer to member function of
> Strawberry.  To make it work, you need to add an explicit downcast:
> 
>   dish.Get<(int const& (Strawberry::*fun)() const)&Strawberry::I>();

I have no standard at hand myself (and maybe should shut up; sorry),
but Stroustrup writes in TC++PL, 3rd ed, 13.2.3 "Template Parameters",
p232, 2nd par:

	A pointer used as a template argument must be of the form &of,
	where of is the name of an object or a function, or of the
	form f, where f is the name of a function.  A pointer to
	member must be of the form &X::of, where of is the name of an
	member.

A cast expression would obviously not be of that form.  I take it the
standard relaxed Stroustrup's requirement so that your suggestion
would be indeed valid?

Cheers,
Marco


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10126


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