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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/cp/cp-gimplify.c.jj     2018-11-17 00:16:41.924381941 +0100
+++ gcc/cp/cp-gimplify.c        2018-11-23 17:29:24.764459373 +0100
@@ -1108,6 +1108,18 @@ cp_genericize_r (tree *stmt_p, int *walk
       || (TREE_CODE (stmt) == AGGR_INIT_EXPR && AGGR_INIT_FROM_THUNK_P
(stmt)))
     {
       *walk_subtrees = 0;
+      /* For CALL_EXPRs, if the arguments aren't decls, recurse into them
+        though.  See PR86943.  */
+      if (TREE_CODE (stmt) == CALL_EXPR)
+       {
+         unsigned int n = call_expr_nargs (stmt);
+         for (unsigned int i = 0; i < n; i++)
+           {
+             tree &arg = CALL_EXPR_ARG (stmt, i);
+             if (!DECL_P (arg))
+               cp_walk_tree (&arg, cp_genericize_r, data, NULL);
+           }
+       }
       return NULL;
     }

seems to fix the double indirection bug (and in make check-c++-all doesn't seem
to regress anything else).  That said, the move constructor is still called
even with -std=c++17 or -std=c++2a.

Reply via email to