https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123783

--- Comment #16 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
(In reply to Jakub Jelinek from comment #15)
> Given http://eel.is/c++draft/expr.prim.splice#2 I think actually trying to
> splice a parameter is always invalid and we should reject it.
> So it should be:
> int func(int counter, float factor) {
>     std::array<void *, parameters_of(^^func).size()> args;
> 
>     std::size_t i = 0;
>     template for (constexpr auto e :
> std::define_static_array(parameters_of(^^func)))
>       args[i++] = &[:variable_of(e):];
>     return 0;
> }
> and of course, in that case
> https://eel.is/c++draft/meta.reflection#queries-65.2 applies (and for the
> lambda case
> http://eel.is/c++draft/expr.prim.splice#2.1.4.1 ).

Right. I continue to think there should be no attempt to capture anything for
the lambda case. And I think the spec of variable_of is just broken, it should
say something like "innermost non-block <ins>non-lambda</ins> scope". But
that's an LWG issue, I think.

Reply via email to