public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/107429] New: misdiagnosed "constraint depends on itself" in overloaded functions @ 2022-10-26 21:03 jwjagersma at gmail dot com 2022-10-27 12:42 ` [Bug c++/107429] " ppalka at gcc dot gnu.org 2022-10-27 16:16 ` jwjagersma at gmail dot com 0 siblings, 2 replies; 3+ messages in thread From: jwjagersma at gmail dot com @ 2022-10-26 21:03 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107429 Bug ID: 107429 Summary: misdiagnosed "constraint depends on itself" in overloaded functions Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jwjagersma at gmail dot com Target Milestone: --- Given the following code: struct tag_foo { } inline constexpr foo; struct tag_bar { } inline constexpr bar; template<typename... T> auto f(tag_foo, T... x) { return (x + ...); } template<typename... T> concept fooable = requires (T... x) { f(foo, x...); }; template<typename... T> requires (fooable<T...>) auto f(tag_bar, T... x) { return f(foo, x...); } auto test() { return f(bar, 1, 2, 3); } g++ claims that "satisfaction of atomic constraint [...] depends on itself", but the overload of 'f()' that is checked by 'fooable' is not constrained in any way. I am not 100% sure if this is valid code, but clang and msvc do not make the same complaint, so I'm inclined to believe g++ is in error here. ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/107429] misdiagnosed "constraint depends on itself" in overloaded functions 2022-10-26 21:03 [Bug c++/107429] New: misdiagnosed "constraint depends on itself" in overloaded functions jwjagersma at gmail dot com @ 2022-10-27 12:42 ` ppalka at gcc dot gnu.org 2022-10-27 16:16 ` jwjagersma at gmail dot com 1 sibling, 0 replies; 3+ messages in thread From: ppalka at gcc dot gnu.org @ 2022-10-27 12:42 UTC (permalink / raw) To: gcc-bugs 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 *** ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/107429] misdiagnosed "constraint depends on itself" in overloaded functions 2022-10-26 21:03 [Bug c++/107429] New: misdiagnosed "constraint depends on itself" in overloaded functions jwjagersma at gmail dot com 2022-10-27 12:42 ` [Bug c++/107429] " ppalka at gcc dot gnu.org @ 2022-10-27 16:16 ` jwjagersma at gmail dot com 1 sibling, 0 replies; 3+ messages in thread From: jwjagersma at gmail dot com @ 2022-10-27 16:16 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107429 --- Comment #2 from jwjagersma at gmail dot com --- Thanks, I thought I searched but somehow missed that PR. From a user perspective it seems very surprising that this workaround compiles, but the obvious implementation doesn't. I do hope it gets addressed someday. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-27 16:16 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-10-26 21:03 [Bug c++/107429] New: misdiagnosed "constraint depends on itself" in overloaded functions jwjagersma at gmail dot com 2022-10-27 12:42 ` [Bug c++/107429] " ppalka at gcc dot gnu.org 2022-10-27 16:16 ` jwjagersma at gmail dot com
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).