public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/114549] New: GCC >= 10.1 selects the wrong overload of C++20 reversed operator== function @ 2024-04-01 17:28 cpeterson at mozilla dot com 2024-04-01 17:33 ` [Bug c++/114549] [11/12/13 Regression] " pinskia at gcc dot gnu.org ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: cpeterson at mozilla dot com @ 2024-04-01 17:28 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114549 Bug ID: 114549 Summary: GCC >= 10.1 selects the wrong overload of C++20 reversed operator== function Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: cpeterson at mozilla dot com Target Milestone: --- While updating Firefox from -std=c++17 to -std=c++20, I found a case where GCC's resolution of C++20 reversed operator== functions behaves differently from the Clang, MSVC, and ICX compilers. This is Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=1880776 I believe this difference was a regression in GCC 10.1. Here's a Godbolt test case comparing those compilers' output: https://godbolt.org/z/qneax5oaW ``` #include <type_traits> struct Thing { template <typename T> bool operator==(const T& rhs) const { /* This operator== is selected by: * GCC versions >= 10.1 -std=c++17 * GCC version 9.5 -std=c++2a * Clang 18.1 -std=c++2a * MSVC 19.38 -std=c++20 * Intel's ICX 2024.0.0 -std=c++20 */ return false; } }; template <typename T> bool operator==(T const& lhs, Thing const& rhs) { /* This operator== is selected by: * GCC versions >= 10.1 -std=c++2a */ return true; } bool test() { Thing const v{}; return v == 3; } ``` ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114549] [11/12/13 Regression] GCC >= 10.1 selects the wrong overload of C++20 reversed operator== function 2024-04-01 17:28 [Bug c++/114549] New: GCC >= 10.1 selects the wrong overload of C++20 reversed operator== function cpeterson at mozilla dot com @ 2024-04-01 17:33 ` pinskia at gcc dot gnu.org 2024-04-01 17:41 ` cpeterson at mozilla dot com ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-04-01 17:33 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114549 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to fail| |10.1.0, 13.1.0, 13.2.0 Summary|GCC >= 10.1 selects the |[11/12/13 Regression] GCC |wrong overload of C++20 |>= 10.1 selects the wrong |reversed operator== |overload of C++20 reversed |function |operator== function Target Milestone|--- |11.5 Keywords| |needs-bisection Known to work| |14.0 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Looks to be fixed on the trunk though. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114549] [11/12/13 Regression] GCC >= 10.1 selects the wrong overload of C++20 reversed operator== function 2024-04-01 17:28 [Bug c++/114549] New: GCC >= 10.1 selects the wrong overload of C++20 reversed operator== function cpeterson at mozilla dot com 2024-04-01 17:33 ` [Bug c++/114549] [11/12/13 Regression] " pinskia at gcc dot gnu.org @ 2024-04-01 17:41 ` cpeterson at mozilla dot com 2024-04-01 17:44 ` pinskia at gcc dot gnu.org ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: cpeterson at mozilla dot com @ 2024-04-01 17:41 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114549 Chris Peterson <cpeterson at mozilla dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #2 from Chris Peterson <cpeterson at mozilla dot com> --- > Looks to be fixed on the trunk though. Thanks for verifying! I see now on godbolt.org that this bug is fixed in GCC trunk (though GCC 13.2.0 still has the bug). In that case, I will resolve this bug as fixed. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114549] [11/12/13 Regression] GCC >= 10.1 selects the wrong overload of C++20 reversed operator== function 2024-04-01 17:28 [Bug c++/114549] New: GCC >= 10.1 selects the wrong overload of C++20 reversed operator== function cpeterson at mozilla dot com 2024-04-01 17:33 ` [Bug c++/114549] [11/12/13 Regression] " pinskia at gcc dot gnu.org 2024-04-01 17:41 ` cpeterson at mozilla dot com @ 2024-04-01 17:44 ` pinskia at gcc dot gnu.org 2024-04-01 17:49 ` mpolacek at gcc dot gnu.org 2024-04-02 11:32 ` rguenth at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-04-01 17:44 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114549 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2024-04-01 Resolution|FIXED |--- Status|RESOLVED |NEW Ever confirmed|0 |1 --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Chris Peterson from comment #2) > > Looks to be fixed on the trunk though. > > Thanks for verifying! I see now on godbolt.org that this bug is fixed in GCC > trunk (though GCC 13.2.0 still has the bug). In that case, I will resolve > this bug as fixed. It was a regression on the other releases so let's leave it open until it is fixed on the release branches or decided it is too hard to do as such. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114549] [11/12/13 Regression] GCC >= 10.1 selects the wrong overload of C++20 reversed operator== function 2024-04-01 17:28 [Bug c++/114549] New: GCC >= 10.1 selects the wrong overload of C++20 reversed operator== function cpeterson at mozilla dot com ` (2 preceding siblings ...) 2024-04-01 17:44 ` pinskia at gcc dot gnu.org @ 2024-04-01 17:49 ` mpolacek at gcc dot gnu.org 2024-04-02 11:32 ` rguenth at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: mpolacek at gcc dot gnu.org @ 2024-04-01 17:49 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114549 Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org Keywords|needs-bisection | --- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Looks like it's changed in r14-6221. Doesn't look backportable. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114549] [11/12/13 Regression] GCC >= 10.1 selects the wrong overload of C++20 reversed operator== function 2024-04-01 17:28 [Bug c++/114549] New: GCC >= 10.1 selects the wrong overload of C++20 reversed operator== function cpeterson at mozilla dot com ` (3 preceding siblings ...) 2024-04-01 17:49 ` mpolacek at gcc dot gnu.org @ 2024-04-02 11:32 ` rguenth at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: rguenth at gcc dot gnu.org @ 2024-04-02 11:32 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114549 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-04-02 11:32 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-04-01 17:28 [Bug c++/114549] New: GCC >= 10.1 selects the wrong overload of C++20 reversed operator== function cpeterson at mozilla dot com 2024-04-01 17:33 ` [Bug c++/114549] [11/12/13 Regression] " pinskia at gcc dot gnu.org 2024-04-01 17:41 ` cpeterson at mozilla dot com 2024-04-01 17:44 ` pinskia at gcc dot gnu.org 2024-04-01 17:49 ` mpolacek at gcc dot gnu.org 2024-04-02 11:32 ` rguenth at gcc dot gnu.org
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).