[Bug c++/104981] [coroutines] Internal compiler error when promise object's constructor takes a base class of the object parameter
ppalka at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 15 21:33:47 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104981
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
The problem seems to be that we're passing the unlowered reference 'this_ref'
to the ctor call, which overload resolution doesn't expect. Using
convert_from_reference fixes this:
diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
index 97bc211ff67..31d0cb7fd16 100644
--- a/gcc/cp/coroutines.cc
+++ b/gcc/cp/coroutines.cc
@@ -4851,6 +4851,7 @@ morph_fn_to_coro (tree orig, tree *resumer, tree
*destroyer)
this_ref = convert_to_reference (rt, this_ref, CONV_STATIC,
LOOKUP_NORMAL, NULL_TREE,
tf_warning_or_error);
+ this_ref = convert_from_reference (this_ref);
vec_safe_push (promise_args, this_ref);
}
else if (parm.rv_ref)
or equivalently, removing the call to convert_to_reference above which seems to
be unneeded?
More information about the Gcc-bugs
mailing list