[Bug c++/100252] [9/10/11/12 Regression] Internal compiler error during template instantiation

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 26 15:58:06 GMT 2022


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

--- Comment #10 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Proof of concept:

--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -3296,6 +3296,14 @@ finish_compound_literal (tree type, tree
compound_literal,
       if (TREE_CODE (compound_literal) == CONSTRUCTOR)
        TREE_HAS_CONSTRUCTOR (compound_literal) = false;
       compound_literal = get_target_expr_sfinae (compound_literal, complain);
+      if (parsing_nsdmi ())
+       {
+         tree obj = TARGET_EXPR_SLOT (compound_literal);
+         tree &ctor = TARGET_EXPR_INITIAL (compound_literal);
+         replace_placeholders (compound_literal, obj);
+         if (TREE_CODE (ctor) == CONSTRUCTOR)
+           CONSTRUCTOR_PLACEHOLDER_BOUNDARY (ctor) = false;
+       }
     }
   else
     /* For e.g. int{42} just make sure it's a prvalue.  */


More information about the Gcc-bugs mailing list