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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libstdc++                   |c++
                 CC|                            |nshead at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2025-10-15
     Ever confirmed|0                           |1

--- Comment #3 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
I've taken a quick look and there's definitely something off.  Here's a reduced
example:

  export module M;
  template <int> struct ic {};
  template <typename T> void go(T x) {
    [&] { ic<x>{}; };
  }

$ g++ -fmodules -S test.cpp
/home/wreien/m/f.cpp:4:3: error: ‘template<class T> go(T)::<lambda()>’ exposes
TU-local entity ‘struct ic<x>’
    4 |   [&] { ic<x>{}; };
      |   ^
/home/wreien/m/f.cpp:2:23: note: ‘struct ic<x>’ declared with internal linkage
    2 | template <int> struct ic {};
      |                       ^~

By-value capture or explicit capture also causes the issue, but it happens
specifically when naming a capture proxy through a template creating a
pseudo-instantiation with internal linkage that then gets complained about.

Reply via email to