[Bug c++/107085] __reference_constructs_from_temporary does not detect static up-cast

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 4 20:41:26 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107085

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
...which could be fixed with

--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -9186,7 +9186,9 @@ conv_is_prvalue (conversion *c)
 {
   if (c->kind == ck_rvalue)
     return true;
-  if (c->kind == ck_base && c->need_temporary_p)
+  if (c->kind == ck_base
+      /* TODO */
+      && (c->need_temporary_p || conv_is_prvalue (next_conversion (c))))
     return true;
   if (c->kind == ck_user && !TYPE_REF_P (c->type))
     return true;

but that then causes ICEs in build_over_call, at cp/call.cc:9987


More information about the Gcc-bugs mailing list