Date: Thu, 17 Sep 2026 00:33:44 +0800
Oops, SFINAE doesn't work even in `using type =
has_or_has_no_type<T>::type;`.
Let me modify a bit:
template <class T>
struct X {
static consteval std::meta::info evaluate()
{ if (std::meta::is_same_type(^^T, ^^int)) return { }; else ... }
static constexpr auto result = evaluate();
};
template <class T> concept C = requires { typename [: X<T>::result :]; };
static_assert(!C<int>); // *error: *cannot splice a null reflection
On 9/17/26 00:20, Bingzhi wrote:
> template <class T>
> struct X {
> static consteval std::meta::info evaluate()
> { if (std::meta::is_same_type(^^T, ^^int)) return { }; else ... }
>
> using type = [: evaluate() :];
> };
> template <class T> concept C = requires { typename X<T>::type; };
> static_assert(!C<int>); // *error: *cannot splice a null reflection
>
>
> I don't know why it is. Can somebody explain?
has_or_has_no_type<T>::type;`.
Let me modify a bit:
template <class T>
struct X {
static consteval std::meta::info evaluate()
{ if (std::meta::is_same_type(^^T, ^^int)) return { }; else ... }
static constexpr auto result = evaluate();
};
template <class T> concept C = requires { typename [: X<T>::result :]; };
static_assert(!C<int>); // *error: *cannot splice a null reflection
On 9/17/26 00:20, Bingzhi wrote:
> template <class T>
> struct X {
> static consteval std::meta::info evaluate()
> { if (std::meta::is_same_type(^^T, ^^int)) return { }; else ... }
>
> using type = [: evaluate() :];
> };
> template <class T> concept C = requires { typename X<T>::type; };
> static_assert(!C<int>); // *error: *cannot splice a null reflection
>
>
> I don't know why it is. Can somebody explain?
Received on 2026-09-16 16:33:52
