[cxx-abi-dev] Mangling of generic lambda
Jason Merrill
jason at redhat.com
Thu Dec 8 18:41:02 UTC 2016
How should 'auto' parameters in a generic lambda be mangled? Mangling
them as normal template parameters doesn't really work, as they can
end up with the same mangling as the template parameter for which they
are an argument.
template<typename T>
T &&forward (T &v)
{
return static_cast<T &&>(v);
}
template<typename FN>
void indirect (FN &&handler)
{
forward<FN> (handler);
}
inline void Foo ()
{
auto lambda = [](auto &) { };
forward (lambda);
indirect (lambda);
}
void (*p)() = Foo;
For this GCC and Clang both currently produce
_Z7forwardIZ3FoovEUlRT_E_EOS0_S1_
where the T_ refers to the template parameter currently being
described, causing the demangler to crash due to infinite recursion
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78252).
Nathan proposes to change the parameters to mangle using Da, which
seems reasonable. I'm not sure how that will extend to concepts, but
concepts mangling as a whole is an unsolved problem.
Any thoughts?
Jason
More information about the cxx-abi-dev
mailing list