This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


2320. constexpr if and boolean conversions

Section: 8.5.2  [stmt.if]     Status: extension     Submitter: Richard Smith     Date: 2016-09-06

Consider:

  template<void *P> void f() {
    if constexpr (P) {}  // #1
  } 

This is ill-formed at #1, because an expression of type void* cannot be converted to bool as a contextually converted constant expression.