OSDN Git Service

Fix PR c++/43704
[pf3gnuchains/gcc-fork.git] / gcc / cp / semantics.c
index 173ef96..589241f 100644 (file)
@@ -2212,7 +2212,7 @@ finish_compound_literal (tree type, tree compound_literal)
   if (TREE_CODE (type) == ARRAY_TYPE)
     cp_complete_array_type (&type, compound_literal, false);
   compound_literal = digest_init (type, compound_literal);
-  if ((!at_function_scope_p () || CP_TYPE_CONST_P (type))
+  if ((!at_function_scope_p () || cp_type_readonly (type))
       && initializer_constant_valid_p (compound_literal, type))
     {
       tree decl = create_temporary_var (type);
@@ -5629,7 +5629,7 @@ capture_decltype (tree decl)
   if (TREE_CODE (type) != REFERENCE_TYPE)
     {
       if (!LAMBDA_EXPR_MUTABLE_P (lam))
-       type = cp_build_qualified_type (type, (cp_type_quals (type)
+       type = cp_build_qualified_type (type, (TYPE_QUALS (type)
                                               |TYPE_QUAL_CONST));
       type = build_reference_type (type);
     }
@@ -5976,6 +5976,18 @@ maybe_add_lambda_conv_op (tree type)
 
   start_preparsed_function (convfn, NULL_TREE,
                            SF_PRE_PARSED | SF_INCLASS_INLINE);
+  if (DECL_ONE_ONLY (statfn))
+    {
+      /* Put the thunk in the same comdat group as the call op.  */
+      struct cgraph_node *callop_node, *thunk_node;
+      DECL_COMDAT_GROUP (statfn) = DECL_COMDAT_GROUP (callop);
+      callop_node = cgraph_node (callop);
+      thunk_node = cgraph_node (statfn);
+      gcc_assert (callop_node->same_comdat_group == NULL);
+      gcc_assert (thunk_node->same_comdat_group == NULL);
+      callop_node->same_comdat_group = thunk_node;
+      thunk_node->same_comdat_group = callop_node;
+    }
   body = begin_function_body ();
   compound_stmt = begin_compound_stmt (0);