[Bug c++/108393] circular concept false-positive

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jan 13 16:15:10 GMT 2023


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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Specifically, ADL for __t == __u finds this function:

  template<C _Iter>
  friend constexpr bool operator==(unreachable_sentinel_t, const _Iter&)
noexcept;

making it an overload resolution candidate. It's not viable, because __t and
__u (which are the same type) cannot be converted to unreachable_sentinel_t.
But if the other parameter is checked first, then that means checking whether
S<unreachable_sentinel_t> satisfies C, because of the constraint C _Iter.

[over.match.viable] says:

- First, to be a viable function, a candidate function shall have enough
parameters to agree in number with the arguments in the list.

This condition is met.

- Second, for a function to be viable, if it has associated constraints
([temp.constr.decl]), those constraints shall be satisfied

The associated constraints are that _Iter satisfies C. This is where the cycle
happens.

- Third, for F to be a viable function, there shall exist for each argument an
implicit conversion sequence that converts that argument to the corresponding
parameter of F.

This is when the function would be discarded from the candidate set, because
S<unreachable_sentinel_t> cannot be converted to unreachable_sentinel_t. But
it's too late, we already blew up at the second step.


More information about the Gcc-bugs mailing list