This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
The following example appears to be ill-formed, although current implementations accept it:
template<bool> struct S { }; S<0> s;
The reason this is ill-formed is that the non-type template argument is a converted constant expression of type bool (see 13.4.3 [temp.arg.nontype] paragraph 5), and the second conversion in the implicit conversion sequence is a boolean conversion, which is not allowed in the conversion for a converted constant expression (see 7.7 [expr.const] paragraph 3) . Conversions in the other direction (from bool to integer types) are permitted here, since they're integral promotions.
Rationale (February, 2012):
The analysis is correct, and the example is ill-formed. Implementations that accept it are in error.