diff options
Diffstat (limited to 'gcc/cp/decl.cc')
-rw-r--r-- | gcc/cp/decl.cc | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 0ff13e9..2852093 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -1069,11 +1069,14 @@ decls_match (tree newdecl, tree olddecl, bool record_versions /* = true */) if (types_match && !DECL_EXTERN_C_P (newdecl) && !DECL_EXTERN_C_P (olddecl) - && record_versions - && maybe_version_functions (newdecl, olddecl, - (!DECL_FUNCTION_VERSIONED (newdecl) - || !DECL_FUNCTION_VERSIONED (olddecl)))) - return 0; + && targetm.target_option.function_versions (newdecl, olddecl)) + { + if (record_versions) + maybe_version_functions (newdecl, olddecl, + (!DECL_FUNCTION_VERSIONED (newdecl) + || !DECL_FUNCTION_VERSIONED (olddecl))); + return 0; + } } else if (TREE_CODE (newdecl) == TEMPLATE_DECL) { @@ -2598,7 +2601,12 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden) else { retrofit_lang_decl (newdecl); - DECL_LOCAL_DECL_ALIAS (newdecl) = DECL_LOCAL_DECL_ALIAS (olddecl); + tree alias = DECL_LOCAL_DECL_ALIAS (newdecl) + = DECL_LOCAL_DECL_ALIAS (olddecl); + DECL_ATTRIBUTES (alias) + = (*targetm.merge_decl_attributes) (alias, newdecl); + if (TREE_CODE (newdecl) == FUNCTION_DECL) + merge_attribute_bits (newdecl, alias); } } @@ -7444,6 +7452,10 @@ check_initializer (tree decl, tree init, int flags, vec<tree, va_gc> **cleanups) if (init && init != error_mark_node) init_code = build2 (INIT_EXPR, type, decl, init); + if (init_code && !TREE_SIDE_EFFECTS (init_code) + && init_code != error_mark_node) + init_code = NULL_TREE; + if (init_code) { /* We might have set these in cp_finish_decl. */ @@ -8542,7 +8554,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, { for (tree t : *cleanups) { - push_cleanup (decl, t, false); + push_cleanup (NULL_TREE, t, false); /* As in initialize_local_var. */ wrap_temporary_cleanups (init, t); } @@ -12231,6 +12243,8 @@ grokdeclarator (const cp_declarator *declarator, pedwarn (loc, OPT_Wpedantic, "%qs specified with %qT", key, type); ok = !flag_pedantic_errors; + type = DECL_ORIGINAL_TYPE (typedef_decl); + typedef_decl = NULL_TREE; } else if (declspecs->decltype_p) error_at (loc, "%qs specified with %<decltype%>", key); @@ -12866,6 +12880,11 @@ grokdeclarator (const cp_declarator *declarator, "type specifier", name); return error_mark_node; } + if (late_return_type && sfk == sfk_conversion) + { + error ("a conversion function cannot have a trailing return type"); + return error_mark_node; + } type = splice_late_return_type (type, late_return_type); if (type == error_mark_node) return error_mark_node; @@ -13030,8 +13049,6 @@ grokdeclarator (const cp_declarator *declarator, maybe_warn_cpp0x (CPP0X_EXPLICIT_CONVERSION); explicitp = 2; } - if (late_return_type_p) - error ("a conversion function cannot have a trailing return type"); } else if (sfk == sfk_deduction_guide) { |