[Bug c++/107429] misdiagnosed "constraint depends on itself" in overloaded functions

ppalka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 27 12:42:06 GMT 2022


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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |ppalka at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Thanks for the bug report.  This is a consequence of CWG2369, and the
constraint recursion diagnosis is strictly speaking correct correct.  I think
other compilers accept it because they don't fully implement
https://wg21.link/cwg2369 which moved the constraint satisfaction check during
template argument deduction to _before_ the checking non-dependent conversions.

A workaround (that should be valid pre- and post-CWG2369) is to encode the
non-dependent conversion in the constrained overload of f as an additional
constraint that's checked before the fooable constraint:

  template<std::convertible_to<tag_bar> U, typename... T> requires
(fooable<T...>)
  auto f(U, T... x)

see PR99599 and its dups for more info

*** This bug has been marked as a duplicate of bug 99599 ***


More information about the Gcc-bugs mailing list