[Bug c++/126223] [15/16/17 Regression] Compiler fails with message "internal compiler error: Segmentation fault"

"ppalka at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126223

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |15.3.0, 16.1.0
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |14.4.0, 15.2.0
   Last reconfirmed|                            |2026-07-31
     Ever confirmed|0                           |1
   Target Milestone|---                         |15.4
                 CC|                            |ppalka at gcc dot gnu.org
           Keywords|                            |ice-on-valid-code
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=120499
            Summary|Compiler fails with message |[15/16/17 Regression]
                   |"internal compiler error:   |Compiler fails with message
                   |Segmentation fault"         |"internal compiler error:
                   |                            |Segmentation fault"

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed, seems to have started with r16-3353 which has been backported to
15.3.

$ cat 126223_a.C
module;
#include <compare>
export module a;

struct A {
    int x;
    std::strong_ordering operator<=>(const A&) const;
};

export struct B {
    A a;
    int y;

    friend auto operator<=>(const B&, const B&) = default;
};

$ cat 126223_b.C
#include <compare>
import a;

bool useB() {
    auto b1 = B{.a = {.x = 1}, .y = 2};
    auto b2 = B{.a = {.x = 1}, .y = 3};
    return b1 < b2;
}

$ g++ -fmodules 126223_{a.C,b.C}
In module a, imported at 126223_b.C:2:
126223_a.C:14:17: internal compiler error: in mangle_module, at
cp/module.cc:16805
   14 |     friend auto operator<=>(const B&, const B&) = default;
      |                 ^~~~~~~~
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.