[C++ PR 78252] illformed lamda?

Nathan Sidwell nathan@acm.org
Tue Nov 22 19:30:00 GMT 2016


Jason,
digging further into the demangler crash of 78252, I think the root 
cause is ill-formed C++.  Here's a further reduced testcase.

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

The first one has 'UlRiE_' for the lambda -- a reference to an int.  The 
second one has 'UlRT_E0_' a reference to the first template parm.  But 
it's in the template parm specification itself (I...E), so that must be 
bogus.

It looks to me that deduction of the lambda's argument type has got 
tangled up with deduction of the template function's type. (I've not 
looked at pt.c yet)

Is that second call of for2 illformed?

nathan

-- 
Nathan Sidwell



More information about the Gcc-bugs mailing list