]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Merge remote-tracking branch 'origin/master' into devel/c++-contracts
authorJason Merrill <jason@redhat.com>
Tue, 1 Nov 2022 02:18:58 +0000 (22:18 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 1 Nov 2022 02:18:58 +0000 (22:18 -0400)
1  2 
gcc/c-family/c.opt
gcc/cp/cp-tree.h
gcc/cp/mangle.cc
gcc/cp/module.cc
gcc/cp/parser.cc
gcc/cp/pt.cc
gcc/cp/typeck.cc
libstdc++-v3/configure
libstdc++-v3/include/Makefile.in
libstdc++-v3/src/Makefile.in

Simple merge
index 4b5d14f6a2988d370a89eab89fba21679ce56bbc,6d84514e4c0f30dd6859d9e1ec75e275e955eb16..f4104c8751dfcf0220a49a612d99a4d7f9d4af56
@@@ -7572,13 -7446,11 +7550,13 @@@ extern tree get_function_template_dec
  extern tree resolve_nondeduced_context                (tree, tsubst_flags_t);
  extern tree resolve_nondeduced_context_or_error       (tree, tsubst_flags_t);
  extern hashval_t iterative_hash_template_arg  (tree arg, hashval_t val);
- extern tree coerce_template_parms               (tree, tree, tree);
extern tree coerce_template_parms               (tree, tree, tree, tsubst_flags_t);
+ extern tree coerce_template_parms             (tree, tree, tree, tsubst_flags_t,
                                               bool = true);
  extern tree canonicalize_type_argument                (tree, tsubst_flags_t);
 +extern void register_local_identity           (tree);
  extern void register_local_specialization       (tree, tree);
  extern tree retrieve_local_specialization       (tree);
 +extern void register_parameter_specializations        (tree, tree);
  extern tree extract_fnparm_pack                 (tree, tree *);
  extern tree template_parm_to_arg                (tree);
  extern tree dguide_name                               (tree);
Simple merge
Simple merge
Simple merge
diff --cc gcc/cp/pt.cc
Simple merge
index 7a1ecb2595a3c6e871edde755a4fc51f983c5d9a,2e0fd8fbf1709c33494875323b55a62f2d646879..50185a0fac8f0ef698fabf649ce8668c9dfa5079
@@@ -11246,15 -11247,20 +11247,26 @@@ check_return_expr (tree retval, bool *n
    if (processing_template_decl)
      return saved_retval;
  
+   /* A naive attempt to reduce the number of -Wdangling-reference false
+      positives: if we know that this function can return a variable with
+      static storage duration rather than one of its parameters, suppress
+      the warning.  */
+   if (warn_dangling_reference
+       && TYPE_REF_P (functype)
+       && bare_retval
+       && VAR_P (bare_retval)
+       && TREE_STATIC (bare_retval))
+     suppress_warning (current_function_decl, OPT_Wdangling_reference);
    /* Actually copy the value returned into the appropriate location.  */
    if (retval && retval != result)
 -    retval = cp_build_init_expr (result, retval);
 +    {
 +      /* If there's a postcondition for a scalar return value, wrap
 +       retval in a call to the postcondition function.  */
 +      if (tree post = apply_postcondition_to_return (retval))
 +      retval = post;
 +      retval = cp_build_init_expr (result, retval);
 +    }
  
    if (tree set = maybe_set_retval_sentinel ())
      retval = build2 (COMPOUND_EXPR, void_type_node, retval, set);
Simple merge
Simple merge
Simple merge