On 14.02.2017 04:31, Stefan Ram wrote:
> Shiyao Ma <
i...@introo.me> writes:
>> auto ff = []{};
>> what's the type of (+ff), and what's the type of (*ff) ?
>
> void (*)()
> void ()
>
> here (gcc).
>
>> And what is happening under the hood for `+' and `*' ?
>
> The operand of the unary + operator shall have arithmetic,
> unscoped enumeration, or pointer type. So, (+ff) is a
> possible constraint violation, because we cannot prove
> that the closure type has the required properties?
>
> The operand of the unary * operator shall have arithmetic,
> unscoped enumeration, or pointer type. So, (*ff) is a
> possible constraint violation, because we cannot prove
> that the closure type has the required properties?
I haven't tried this but `[]{}` has an implicit conversion to
`void(*)()` so I think probably `*ff` should be valid.
Cheers!
- Alf