Date
2022-11-20.07:54:16
Message id
3625

Content

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.