diff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc index 24e84eac1c3..208975b77fa 100644 --- a/gcc/cp/reflect.cc +++ b/gcc/cp/reflect.cc @@ -4448,11 +4448,6 @@ eval_can_substitute (location_t loc, const constexpr_ctx *ctx, return throw_exception (loc, ctx, N_("invalid argument to can_substitute"), a, jump_target); - tree type = type_of (a, kind); - if (!structural_type_p (type)) - return throw_exception (loc, ctx, - N_("argument without structural type"), - a, jump_target); } a = resolve_nondeduced_context (a, tf_warning_or_error); TREE_VEC_ELT (rvec, i) = a; diff --git a/gcc/testsuite/g++.dg/reflect/can_substitute1.C b/gcc/testsuite/g++.dg/reflect/can_substitute1.C index e9e8570278d..344720d59bd 100644 --- a/gcc/testsuite/g++.dg/reflect/can_substitute1.C +++ b/gcc/testsuite/g++.dg/reflect/can_substitute1.C @@ -154,8 +154,7 @@ static_assert (could_substitute (^^S, { reflect_constant (42) })); constexpr int n = 42; static_assert (could_substitute (^^S, { ^^n })); constexpr NS nsv (42); -// nsv doesn't have structural type -static_assert (!could_substitute (^^S, { ^^nsv })); +static_assert (could_substitute (^^S, { ^^nsv })); static_assert (!can_substitute (^^S, {})); static_assert (can_substitute (^^S, { ^^int })); @@ -164,6 +163,7 @@ static_assert (can_substitute (^^S, { ^^NS })); static_assert (!can_substitute (^^S, { ^^int, ^^long })); static_assert (!can_substitute (^^S, { reflect_constant (42) })); static_assert (!can_substitute (^^S, { ^^n })); +static_assert (!can_substitute (^^S, { ^^nsv })); static_assert (!can_substitute (^^T, {})); static_assert (!can_substitute (^^T, { ^^float, ^^int })); constexpr float fv = 42.0f;