I discovered a bug in my fix for 82195, but it leads me towards a design question whose answer is not obvious to me

the simplest testcase is:

void Foo () {
  // _ZZ3FoovENKUlT_E_clIiEEfS_
  [](auto) ->float {
    struct Local {
      // _ZZZ3FoovENKUlT_E_clIiEEfS_EN5Local2fnEv
      static void fn () {}
    };
    Local::fn ();
    return 0.0f;
  } (0);
}

consider the demangled name of that Local::fn function. we have to encode the enclosing template instantiation of the lambda function operator. Where should that function's return type be? I can think of 3 alternatives:

1) as close to the operator () as possible:
Foo ()::{lambda(auto:1)}::float operator<int> (int)::Local::fn ()

2) just before the 'lambda', the local class it's a member of
Foo ()::float {lambda(auto:1)}::operator<int> (int)::Local::fn ()

3) just before the fully scoped name:
float Foo ()::{lambda(auto:1)}::operator<int> (int)::Local::fn ()

#3 will be confusing if Local::fn and/or Foo are template instantiations, which contain their own return types. We'd need parentheses or something.

#2 seemed like the natural place -- if one was mangling the class member fn on its own, one would write
  'float {lambda(auto:1)}::operator <int> (int)'
but that does separate the float from the entity it belongs to, which could be confusing in a complicated demangle.

Another alternative is to elide return types in such nested local names.

thoughts?

nathan

--
Nathan Sidwell

Reply via email to