Title
constexpr if and boolean conversions
Status
extension
Section
8.5.2 [stmt.if]
Submitter
Richard Smith

Created on 2016-09-06.00:00:00 last changed 100 months ago

Messages

Date: 2022-02-18.07:47:23

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.

History
Date User Action Args
2016-09-06 00:00:00admincreate