Re: [C++ PR 78252] illformed lamda?

2016-11-23 Thread Jason Merrill
On Wed, Nov 23, 2016 at 10:34 AM, Nathan Sidwell  wrote:
> On 11/22/2016 02:26 PM, Nathan Sidwell wrote:
>>
>> template
>> void for2 (T )
>> {
>> }
>>
>> 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?

That sounds good.  I wonder why is_auto doesn't already return true for them?

Jason


Re: 3.0: Troubling warning in dwarf2out.c

2001-05-19 Thread Jason Merrill

 Mark == Mark Mitchell [EMAIL PROTECTED] writes:

 Jason == Jason Merrill [EMAIL PROTECTED] writes:
Jason Wouldn't it make sense for the definition of
Jason ASM_OUTPUT_INTERNAL_LABEL to simply cast num to the
Jason appropriate type if it wants to use fprintf?

 It would be better if we would treat these macros like functions, and
 specify their types.  

Yep, that's basically what I was saying.

 In fact, most of them should just *be* functions, in my opinion.

Agreed.

Jason