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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Maybe just special case VOID_TYPE_P in there?
--- gcc/cp/constexpr.cc.jj      2025-01-02 11:47:10.290500486 +0100
+++ gcc/cp/constexpr.cc 2025-01-03 17:28:23.879757899 +0100
@@ -8870,14 +8870,17 @@ cxx_eval_outermost_constant_expr (tree t
   /* Turn off -frounding-math for manifestly constant evaluation.  */
   warning_sentinel rm (flag_rounding_math,
                       ctx.manifestly_const_eval == mce_true);
-  tree type = (object
-              ? cv_unqualified (TREE_TYPE (object))
-              : initialized_type (t));
+  tree type = initialized_type (t);
+  if (object && !VOID_TYPE_P (type))
+    type = cv_unqualified (TREE_TYPE (object));
   tree r = t;
   bool is_consteval = false;
   if (VOID_TYPE_P (type))
     {
-      if (!constexpr_dtor)
+      if (constexpr_dtor)
+       /* Used for destructors of array elements.  */
+       type = cv_unqualified (TREE_TYPE (object));
+      else
        {
          if (cxx_dialect < cxx20)
            return t;
is a partial reversion of that patch, which keeps previous behavior for the
VOID_TYPE_P (initialized_type (t)) case (dunno about cv_unqualified vs. nothing
for the dtors case) but still fixes the constexpr-prvalue{2,3}.C ICEs.

Reply via email to