Date: Thu, 27 Apr 2023 10:35:45 -0700
On Thursday, 27 April 2023 08:26:11 PDT Brian Bi via Std-Discussion wrote:
> I think the question that the OP meant to ask is whether a lambda
> expression appearing in a default template argument has the same type every
> time the default template argument gets used. (See the subject line.)
>
> My take is that if the code has some bug unrelated to what the OP meant to
> ask, one should point out the bug but also answer what they meant to ask.
> Pointing out CWG 2542 accomplishes the first part of this, but not the
> second.
Indeed, I want to know is whether the default lambda in the unevaluated
context has the same type every time its product is evaluated. I ended up
reducing the example to its simplest form, which was to use the CNTTP as a
parameter, but that isn't required.
This other example shows the actual root case:
template <typename T = decltype([]{})> struct S {};
static_assert(!std::is_same_v<S<>, S<>>);
See https://conformance.godbolt.org/z/rzMsnjPdE (it causes ICE with all but
latest MSVC, and I needed to raise the Clang minimum to 13).
> I think the question that the OP meant to ask is whether a lambda
> expression appearing in a default template argument has the same type every
> time the default template argument gets used. (See the subject line.)
>
> My take is that if the code has some bug unrelated to what the OP meant to
> ask, one should point out the bug but also answer what they meant to ask.
> Pointing out CWG 2542 accomplishes the first part of this, but not the
> second.
Indeed, I want to know is whether the default lambda in the unevaluated
context has the same type every time its product is evaluated. I ended up
reducing the example to its simplest form, which was to use the CNTTP as a
parameter, but that isn't required.
This other example shows the actual root case:
template <typename T = decltype([]{})> struct S {};
static_assert(!std::is_same_v<S<>, S<>>);
See https://conformance.godbolt.org/z/rzMsnjPdE (it causes ICE with all but
latest MSVC, and I needed to raise the Clang minimum to 13).
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel DCAI Cloud Engineering
Received on 2023-04-27 17:35:47