https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97572

--- Comment #2 from Dimitri Gorokhovik <dimitri.gorokhovik at free dot fr> ---
Fair enough, passing a boolean by value into 'any()' is evaluation of local
parameter 't', and that is prohibited (7.5.7.4/2). 

Doesn't this merit a better diagnostics though?

A slightly modified code:

constexpr bool any (bool) { return true; };
template <typename T> concept Any = requires (T t) { requires any (t); };
static_assert (Any <bool>);

produces:

constexpr bool any(bool)
<stdin>:2:63: error: ‘t’ is not a constant expression
<stdin>: At global scope:
<stdin>:3:16: error: static assertion failed
<stdin>:3:16: note: constraints not satisfied
<stdin>:2:31:   required by the constraints of ‘template<class T> concept Any’
<stdin>:2:37:   in requirements with ‘T t’ [with T = bool]
<stdin>:2:63: error: ‘t’ is not a constant expression
<stdin>:2:67: note: nested requirement ‘any(t)’ is not satisfied, because
<stdin>:2:68: error: cannot convert ‘T’ to ‘bool’
<stdin>:1:21: note:   initializing argument 1 of ‘constexpr bool any(bool)’

which completely leads to believe that the culprit is in the line 2 whereas it
is in the line 1 (which doesn't even have a 't')?

Reply via email to