This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/29704] [4.1 Regression] ICE: default non-type template argument of pointer-to-member type
- From: "jens dot maurer at gmx dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Nov 2006 20:24:30 -0000
- Subject: [Bug c++/29704] [4.1 Regression] ICE: default non-type template argument of pointer-to-member type
- References: <bug-29704-1824@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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