[Bug c++/29704] [4.1 Regression] ICE: default non-type template argument of pointer-to-member type

jens dot maurer at gmx dot net gcc-bugzilla@gcc.gnu.org
Tue Nov 14 20:24:00 GMT 2006



------- Comment #3 from jens dot maurer at gmx dot net  2006-11-14 20:24 -------
I agree with Wolfgang's interpretation of the standard, but can't see why it
renders my original code invalid.

14.3.2/1 says that "a constant expression that evaluates to a null member
pointer value" is allowed as a non-type template argument, with an explicit
reference to 4.11, which explains how to obtain one (i.e. convert a null
pointer constant, e.g. 0, to a pointer-to-member type).  That's what my
original example does.  14.3.2/5 then says "The following conversions are
performed on each expression used as a non-type template-argument."  There are
indeed no conversions performed for pointer-to-members, but the expression I
supplied for the non-type template-argument was "(void(C::*)(int))0", not just
0 (which would have required an implicit conversion, see 4.11).  And no
conversion is necessary to convert an expression of that type to the
parameter's type, which is  void(C::*)(int).
(EDG appears to agree with me and accepts the code, FWIW.)


-- 


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



More information about the Gcc-bugs mailing list