This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Bug with null pointer to member as template argument
- To: dm at reeducation-labor dot lcs dot mit dot edu
- Subject: Re: Bug with null pointer to member as template argument
- From: Mark Mitchell <mark at markmitchell dot com>
- Date: Wed, 16 Dec 1998 16:14:18 -0800
- CC: egcs-bugs at cygnus dot com
- References: <199812162148.QAA03964@reeducation-labor.lcs.mit.edu>
- Reply-to: mark at markmitchell dot com
>>>>> "David" == David Mazieres <dm@reeducation-labor.lcs.mit.edu> writes:
David> Using "gcc version egcs-2.92.23 19981125 (gcc2 ss-980609
David> experimental)" and earlier, egcs rejects the following C++
David> program:
David> template<class T, int T::*field> struct list {};
David> struct foo { int x; list<foo, 0> subfoos; };
David> giving the error:
David> voidmp.C:5: could not convert template argument `0' to
David> `int foo::*' voidmp.C:5: warning: ANSI C++ forbids
David> declaration `subfoos' with no type
David> I searched through the standard, and can't find any reason
David> the program should be rejected. Certainly 0 is a valid
You missed:
A template-argument for a non-type, non-template
template-parameter shall be one of:
...
--a pointer to member expressed as described in _expr.unary.op_.
which says that you must write `&C::f' for some choice of `C' and
`f'. Also:
For a non-type template-parameter of type pointer to member
function, no conversions apply.
--
Mark Mitchell mark@markmitchell.com
Mark Mitchell Consulting http://www.markmitchell.com