[Bug c++/94807] New: Inconsistency in lambda instantiation

nathan at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Apr 27 20:18:14 GMT 2020


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

            Bug ID: 94807
           Summary: Inconsistency in lambda instantiation
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nathan at gcc dot gnu.org
  Target Milestone: ---

The parser renames a lambda's function operator's object pointer argument to be
'__closure' (closure_identifier).  This gets lost, if that lambda's in a
template, when the containing template is instantiated.

This is confusing to compiler devs, and (at least) causes a workaround in the
coro machinery.

template<int I> struct frob
{
  int i;
  void m ()
  {
    auto b = [] {};  // named __closure in the template
    b ();
  }
};


frob<0> i;

int x ()
{
  i.m (); // named __this in the instantiation
}


More information about the Gcc-bugs mailing list