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

            Bug ID: 122019
           Summary: ICE with modules and extern lambda
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ingo at hannover dot ccc.de
  Target Milestone: ---

Created attachment 62427
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62427&action=edit
backtrace

The following code results in an ICE:

import std;
extern "C" auto foo = [] { std::format("bar"); };

Building with:
$ g++ -std=c++20 -fmodules -fsearch-include-path -c bits/std.cc -o /dev/null
$ g++ -std=c++20 -fmodules -freport-bug ice.cc
ice.cc:2:17: warning: ‘foo’ initialized and declared ‘extern’
    2 | extern "C" auto foo = [] { std::format("bar"); };
      |                 ^~~
ice.cc: In lambda function:
ice.cc:2:33: internal compiler error: Segmentation fault
    2 | extern "C" auto foo = [] { std::format("bar"); };
      |                                 ^~~~~~

I know the code is weird, it was a (failed) experiment, but it should not
result in an ICE.

Reply via email to