[C++ PR 78252] illformed lamda?
Nathan Sidwell
nathan@acm.org
Wed Nov 23 15:35:00 GMT 2016
On 11/22/2016 02:26 PM, Nathan Sidwell wrote:
> template<typename T>
> void for2 (T &v)
> {
> }
>
> void Foo ()
> {
> auto lam_1 = [](int &) { };
> auto lam_2 = [](auto &) { }; // IIUC this is implicitly templatey
>
> for2 (lam_1);
> for2 (lam_2); // What is the lambda's argument type?
> }
>
> We get 2 instantiations of for2:
> .type _Z4for2IZ3FoovEUlRiE_EvRT_, @function
> .type _Z4for2IZ3FoovEUlRT_E0_EvS1_, @function
Ok. looking further, I now think this is well formed.
lam_2's 'auto &' parameter creates an implicit templated function
operator member function. We could have used 'Da' to refer to the auto
parms, but we didn't. I think that means that the demangler needs to be
taught that 'T[n]_' occurring inside a lambda's argument encoding means
'auto' and does not refer to any containing template instantiation name?
nathan
--
Nathan Sidwell
More information about the Gcc-bugs
mailing list