https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122658
mkryss <mkryss at proton dot me> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mkryss at proton dot me
--- Comment #3 from mkryss <mkryss at proton dot me> ---
Slightly more reduced testcase that still ICEs:
struct S {
consteval S () noexcept { }
consteval S (const S &) = default;
};
template <typename T>
void
foo ()
{
constexpr auto s = S();
}
Seems that this is caused by build_over_call calling build_cplus_new in
template decls to generate a TARGET_EXPR that is then passed to
fold_non_dependent_expr, which ends up calling tsubst_expr and it ICEs since
tsubst_expr doesn't handle TARGET_EXPRs.
>From what I've been told in the mailing list, tsubst_expr shouldn't handle
TARGET_EXPRs, but build_over_call should probably instead be prevented from
generating the TARGET_EXPR in the first place, but I'm not really sure how to
go about this. This is the code that generates the TARGET_EXPR in
build_over_call:
if (obj_arg
&& is_dummy_object (obj_arg)
&& !type_dependent_expression_p (obj_arg))
{
exprimm = build_cplus_new (DECL_CONTEXT (fn), expr, complain);
obj_arg = NULL_TREE;
}
I'm not really familiar with the codebase to I'm not sure what this is supposed
to be doing in the first place, but I'm assuming it's there for a reason so it
can't just be removed? Running the C++ testsuite, this codepath seems to never
be executed once.
I would appreciate some help with this.