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

Nathaniel Shead <nshead at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |nshead at gcc dot 
gnu.org

--- Comment #4 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Reduced:

  // std.cc
  export module std;
  template <typename _Out> void format(_Out) {
    constexpr int __term = 0;
    [&] { __term; };
  }
  export inline void vformat() {
    format(0);
  }

  // std.compat.cc
  import std;
  int x = (vformat(), 0);

$ g++ -fmodules -S std.cc std.compat.cc
In module imported at std.compat.ii:1:1:
std: error: failed to read compiled module cluster 2: Bad file data
std: note: compiled module file is ‘gcm.cache/std.gcm’
std: error: failed to read compiled module cluster 3: Bad file data
std.compat.cc:2:10: fatal error: failed to load binding ‘::vformat@std’
    2 | int x = (vformat(), 0);
      |          ^~~~~~~
compilation terminated.

The issue appears to be that when loading the lambda we look for '__term' as a
member in its context, but it actually lives outside the lambda so it isn't
found and we bail.

Reply via email to