X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gcc%2Fcp%2FChangeLog;h=f6abb8445903947db5265a2a4816a43f3fa3c09d;hb=f22f817cbdffe5b4e7d0ba7ab0eeb56ee61b3b72;hp=d5c7e13f64d24ed4e65a16beab7dcfc86d345ebc;hpb=8e5993e236a50ffc161dd45d1ef3ab86133e3363;p=gcc.git diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d5c7e13f64d..f6abb844590 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,440 @@ +2019-11-04 Jason Merrill + + * constexpr.c (explain_invalid_constexpr_fn): Show location of fn. + + * pt.c (maybe_instantiate_noexcept): Only update clones if we + instantiated. + + * typeck.c (contextual_conv_bool): New. + + * name-lookup.c (lookup_qualified_name): Add wrapper overload taking + C string rather than identifier. + * parser.c (cp_parser_userdef_numeric_literal): Use it. + * rtti.c (emit_support_tinfos): Use it. + * cp-tree.h (ovl_op_identifier): Change to inline functions. + (build_x_binary_op): Add wrapper with fewer parms. + +2019-11-05 Jason Merrill + + * decl2.c (mark_used): Diagnose use of a function with unsatisfied + constraints here. + * typeck.c (cp_build_function_call_vec): Not here. + +2019-11-05 Nathan Sidwell + + PR c++/92370 + * parser.c (cp_parser_error_1): Check EOF and UNKNOWN_LOCATION + when skipping over version control marker. + +2019-11-05 Jakub Jelinek + + PR c++/92343 + * constexpr.c (potential_constant_expression_1): Return true rather + than false for PREDICT_EXPR. + + * decl.c (omp_declare_variant_finalize_one): Call + declare_simd_adjust_this not just on the context, but also on the + variant-id expression for methods. Don't call + cp_get_callee_fndecl_nofold, call cp_get_callee and only if it is + safe cp_get_fndecl_from_callee. Don't try to print as %qD + NULL in diagnostics. + * pt.c (tsubst_attribute): Handle "omp declare variant base" + attribute. + (tsubst_function_decl): Call omp_declare_variant_finalize + if there are any "omp declare variant base" attributes left. + +2019-11-04 Kamlesh Kumar + + PR c++/91979 - mangling nullptr expression + * mangle.c (write_template_arg_literal): Handle nullptr + mangling. + +2019-11-04 Jason Merrill + + * typeck.c (check_return_expr): Avoid redundant error. + +2019-11-02 Paolo Carlini + + * typeck.c (composite_pointer_type): Add a const op_location_t& + parameter and use it in diagnostics. + (composite_pointer_error): Likewise. + (composite_pointer_type_r): Add a const op_location_t& + parameter and forward it. + (cp_build_binary_op): Adjust calls. + (common_pointer_type): Likewise. + * call.c (add_builtin_candidate): Likewise. + (build_conditional_expr_1): Likewise. + * cp-tree.h (composite_pointer_type): Update declaration. + + * typeck.c (cxx_sizeof_expr): Use cp_expr_loc_or_input_loc + in permerror. + (cxx_alignof_expr): Likewise. + (lvalue_or_else): Likewise. + +2019-11-02 Jakub Jelinek + + * decl.c (omp_declare_variant_finalize_one): Use + omp_get_context_selector instead of c_omp_get_context_selector. + + PR c++/89640 + * parser.c (cp_parser_decl_specifier_seq): Don't parse attributes + if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR. + + PR c++/88335 - Implement P1073R3: Immediate functions + * cp-tree.h (struct lang_decl_fn): Add immediate_fn_p bit. + (DECL_IMMEDIATE_FUNCTION_P, SET_DECL_IMMEDIATE_FUNCTION_P): Define. + (enum cp_decl_spec): Add ds_consteval. + (fold_non_dependent_expr): Add another tree argument defaulted to + NULL_TREE. + * name-lookup.h (struct cp_binding_level): Add immediate_fn_ctx_p + member. + * parser.c (cp_keyword_starts_decl_specifier_p): Adjust comments + for C++11 and C++20 specifiers. Handle RID_CONSTEVAL. + (CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR): Adjust comment. + (CP_PARSER_FLAGS_CONSTEVAL): New. + (cp_parser_skip_balanced_tokens): New forward declaration. + (cp_parser_lambda_declarator_opt): Handle ds_consteval. Set + current_binding_level->immediate_fn_ctx_p before parsing parameter + list if decl-specifier-seq contains consteval specifier. + (cp_parser_decl_specifier_seq): Handle RID_CONSTEVAL. + (cp_parser_explicit_instantiation): Diagnose explicit instantiation + with consteval specifier. + (cp_parser_init_declarator): For consteval or into flags + CP_PARSER_FLAGS_CONSTEVAL. + (cp_parser_direct_declarator): If CP_PARSER_FLAGS_CONSTEVAL, set + current_binding_level->immediate_fn_ctx_p in the sk_function_parms + scope. + (set_and_check_decl_spec_loc): Add consteval entry, formatting fix. + * call.c (build_addr_func): For direct calls to immediate functions + use build_address rather than decay_conversion. + (build_over_call): Evaluate immediate function invocations. + * error.c (dump_function_decl): Handle DECL_IMMEDIATE_FUNCTION_P. + * semantics.c (expand_or_defer_fn_1): Use tentative linkage and don't + call mark_needed for immediate functions. + * typeck.c (cxx_sizeof_or_alignof_expr): Likewise. Formatting fix. + (cp_build_addr_expr_1): Reject taking address of immediate function + outside of immediate function. + * decl.c (validate_constexpr_redeclaration): Diagnose consteval + vs. non-consteval or vice versa redeclaration. Use + SET_DECL_IMMEDIATE_FUNCTION_P if new_decl is immediate function. + (check_tag_decl): Use %qs with keyword string to simplify translation. + Handle ds_consteval. + (start_decl): Adjust diagnostics for static or thread_local variables + in immediate functions. + (grokfndecl): Call sorry_at on virtual consteval. Use %qs with keyword + to string to simplify translation. Diagnose consteval main. Use + SET_DECL_IMMEDIATE_FUNCTION_P for consteval. + (grokdeclarator): Handle consteval. Use %qs with keyword strings to + simplify translation. Use separate ifs instead of chained else if + for invalid specifiers. For constinit clear constinit_p rather than + constexpr_p. + * constexpr.c (find_immediate_fndecl): New function. + (cxx_eval_outermost_constant_expr): Allow consteval calls returning + void. Diagnose returning address of immediate function from consteval + evaluation. + (fold_non_dependent_expr_template): Add OBJECT argument, pass it + through to cxx_eval_outermost_constant_expr. + (fold_non_dependent_expr): Add OBJECT argument, pass it through to + fold_non_dependent_expr_template. + (fold_non_dependent_init): Adjust fold_non_dependent_expr_template + caller. + * method.c (defaulted_late_check): Adjust diagnostics for consteval. + * lambda.c (maybe_add_lambda_conv_op): Copy over + DECL_DECLARED_CONSTEXPR_P and DECL_IMMEDIATE_FUNCTION_P bits from + callop to both artificial functions. + * init.c (build_value_init): Don't do further processing if + build_special_member_call returned a TREE_CONSTANT. Formatting fix. + + PR c++/91369 - Implement P0784R7: constexpr new + * cp-tree.h (CALL_FROM_NEW_OR_DELETE_P): Define. + * init.c (build_new_1, build_vec_delete_1, build_delete): Set + CALL_FROM_NEW_OR_DELETE_P on the CALL_EXPR to allocator functions. + * constexpr.c (is_std_allocator_allocate): Only allow + global replaceable allocator functions if CALL_FROM_NEW_OR_DELETE_P + or in std::allocate::{,de}allocate. + (potential_constant_expression_1): Likewise. + +2019-11-01 Nathan Sidwell + + * class.c (check_field_decls): Refactor. + +2019-10-31 Jakub Jelinek + + PR c++/90947 + * cp-tree.h (type_initializer_zero_p): Declare. + * decl.c (reshape_init_array_1): Formatting fix. + * tree.c (type_initializer_zero_p): New function. Moved from + ../tree.c, use next_initializable_field, formatting fix. Return + false for TYPE_NON_AGGREGATE_CLASS types. + +2019-10-30 Jason Merrill + + PR c++/92268 - hard error satisfying return-type-requirement + * constraint.cc (type_deducible_p): Check for substitution failure. + (diagnose_compound_requirement): Adjust diagnostic. + * pt.c (do_auto_deduction): Don't pass cargs to + constraints_satisfied_p. + +2019-10-30 Jakub Jelinek + + PR c++/91369 - Implement P0784R7: constexpr new + * constexpr.c (cxx_replaceable_global_alloc_fn): Don't return true + for placement new. + (cxx_placement_new_fn, is_std_construct_at): New functions. + (cxx_eval_call_expression): Allow placement new in std::construct_at. + (potential_constant_expression_1): Likewise. + + * typeck.c (decl_in_std_namespace_p): Return true also for decls + in inline namespaces inside of std namespace. + +2019-10-30 Bernd Edlinger + + PR c++/92024 + * name-lookup.c (check_local_shadow): Shadowing TYPE_DECLs + is always a -Wshadow=compatible-local warning, unless + -Wshadow is used. + +2019-10-30 Jason Merrill + + * cxx-pretty-print.c (get_fold_operator): Use OVL_OP_INFO. + +2019-10-30 Marek Polacek + + PR c++/92134 - constinit malfunction in static data member. + * decl2.c (grokfield): Set LOOKUP_CONSTINIT. + +2019-10-30 Jakub Jelinek + + * cp-tree.h (omp_declare_variant_finalize, build_local_temp): Declare. + * decl.c: Include omp-general.h. + (declare_simd_adjust_this): Add forward declaration. + (omp_declare_variant_finalize_one, omp_declare_variant_finalize): New + function. + (cp_finish_decl, finish_function): Call omp_declare_variant_finalize. + * parser.c (cp_finish_omp_declare_variant): Adjust parsing of the + variant id-expression and propagate enough information to + omp_declare_variant_finalize_one in the attribute so that it can + finalize it. + * class.c (finish_struct): Call omp_declare_variant_finalize. + * tree.c (build_local_temp): No longer static, remove forward + declaration. + +2019-10-30 Paolo Carlini + + * typeck.c (cp_build_modify_expr): Prefer error + inform to + error + error in one place. + (get_delta_difference_1): Likewise. + (get_delta_difference): Likewise, in two places. + +2019-10-29 Paolo Carlini + + * typeck.c (build_x_unary_op): Use the location_t argument in + three error_at. + +2019-10-29 Marek Polacek + + PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion. + * call.c (joust): Don't attempt to warn if ->second_conv is null. + +2019-10-29 Jakub Jelinek + + PR c++/92201 + * cp-gimplify.c (cp_gimplify_expr): If gimplify_to_rvalue changes the + function pointer type, re-add cast to the original one. + +2019-10-29 Marek Polacek + + PR c++/91548 - fix detecting modifying const objects for ARRAY_REF. + * constexpr.c (cxx_eval_store_expression): Don't call + modifying_const_object_p for ARRAY_REF. + +2019-10-29 Richard Sandiford + + * cp-objcp-common.h (cxx_simulate_enum_decl): Declare. + (LANG_HOOKS_SIMULATE_ENUM_DECL): Define to the above. + * decl.c (cxx_simulate_enum_decl): New function. + +2019-10-29 Richard Sandiford + + * cp-tree.h (cxx_simulate_builtin_function_decl): Declare. + * decl.c (cxx_simulate_builtin_function_decl): New function. + * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL): + Define to the above. + +2019-10-28 Martin Sebor + + PR c/66970 + * cp-objcp-common.c (names_builtin_p): Define new function. + +2019-10-28 Nathan Sidwell + + * parser.h (struct cp_token): Drop {ENUM,BOOL}_BITFIELD C-ism. + Add tree_check_p flag, use as nested union discriminator. + (struct cp_lexer): Add saved_type & saved_keyword fields. + * parser.c (eof_token): Delete. + (cp_lexer_new_main): Always init last_token to last token of + buffer. + (cp_lexer_new_from_tokens): Overlay EOF token at end of range. + (cp_lexer_destroy): Restore token under the EOF. + (cp_lexer_previous_token_position): No check for eof_token here. + (cp_lexer_get_preprocessor_token): Clear tree_check_p. + (cp_lexer_peek_nth_token): Check CPP_EOF not eof_token. + (cp_lexer_consume_token): Assert not CPP_EOF, no check for + eof_token. + (cp_lexer_purge_token): Likewise. + (cp_lexer_purge_tokens_after): No check for EOF token. + (cp_parser_nested_name_specifier, cp_parser_decltype) + (cp_parser_template_id): Set tree_check_p. + +2019-10-24 Jakub Jelinek + + * decl2.c (cplus_decl_attributes): Add "omp declare target block" + attribute in between declare target and end declare target + pragmas. + + * call.c (convert_arg_to_ellipsis): Add missing space in string + literal. + +2019-10-24 Marek Polacek + + * decl.c (reshape_init_r): Add missing space. + +2019-10-24 Nathan Sidwell + + * pt.c (reduce_template_parm_level): Attach the new TPI to the new + DECL. + (convert_generic_types_to_packs): Pass the copied type to + reduce_templatE_parm_level. + +2019-10-23 Nathan Sidwell + + * cp-tree.c (CPTI_STD_IDENTIFIER): Delete. + (std_identifier): Delete. + (DECL_NAME_SPACE_STD_P): Compare against std_node. + * decl.c (initialize_predefined_identifiers): 'std' is not needed. + (cxx_init_decl_processing): Adjust creation of ::std. Use + {push,pop}_nested_namespace. + (cxx_builtin_function): Use {push,pop}_nested_namespace. + * except.c (init_exception_processing): Likewise. + * rtti.c (init_rtti_processing): Likewise. + +2019-10-23 Jason Merrill + + Implement P1286R2, Contra CWG1778 + * method.c (defaulted_late_check): Don't check explicit + exception-specification on defaulted function. + (after_nsdmi_defaulted_late_checks): Remove. + * parser.h (struct cp_unparsed_functions_entry): Remove classes. + * parser.c (unparsed_classes): Remove. + (push_unparsed_function_queues, cp_parser_class_specifier_1): + Adjust. + +2019-10-23 Jakub Jelinek + + * constexpr.c (cxx_eval_constant_expression) : + Temporarily change input_location to CLEANUP_STMT location. + +2019-10-22 Jakub Jelinek + + PR tree-optimization/85887 + * decl.c (expand_static_init): Drop ECF_LEAF from __cxa_guard_acquire + and __cxa_guard_release. + +2019-10-22 Marc Glisse + + PR c++/85746 + * constexpr.c (cxx_eval_builtin_function_call): Only set + force_folding_builtin_constant_p if manifestly_const_eval. + +2019-10-22 Richard Sandiford + + * cp-tree.h (STF_USER_VISIBLE): New constant. + (strip_typedefs, strip_typedefs_expr): Take a flags argument. + * tree.c (strip_typedefs, strip_typedefs_expr): Likewise, + updating mutual calls accordingly. When STF_USER_VISIBLE is true, + only look through typedefs if user_facing_original_type_p. + * error.c (dump_template_bindings, type_to_string): Pass + STF_USER_VISIBLE to strip_typedefs. + (dump_type): Likewise, unless pp_c_flag_gnu_v3 is set. + +2019-10-21 Kamlesh Kumar + Jason Merrill + + PR c++/83534 - typeinfo of noexcept function + * rtti.c (get_tinfo_decl_dynamic): Do not call + TYPE_MAIN_VARIANT for function. + (get_typeid): Likewise. + +2019-10-21 Paolo Carlini + + * parser.c (cp_parser_class_head): Improve error recovery upon + extra qualification error. + +2019-10-21 Jakub Jelinek + + PR c++/92015 + * constexpr.c (cxx_eval_component_reference, cxx_eval_bit_field_ref): + Use STRIP_ANY_LOCATION_WRAPPER on CONSTRUCTOR elts. + +2019-10-21 Marek Polacek + + PR c++/92062 - ODR-use ignored for static member of class template. + * pt.c (has_value_dependent_address): Strip location wrappers. + +2019-10-21 Marek Polacek + + PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr. + * typeck.c (maybe_warn_about_returning_address_of_local): Avoid + recursing on null initializer and return false instead. + +2019-10-17 JeanHeyd Meneide + + Implement p1301 [[nodiscard("should have a reason")]] + p1771 DR + * tree.c (handle_nodiscard_attribute): Handle C++2a nodiscard + string message. + (std_attribute_table) Increase nodiscard argument handling + max_length from 0 to 1. + * parser.c (cp_parser_check_std_attribute): Add requirement + that nodiscard only be seen once in attribute-list. + (cp_parser_std_attribute): Check that empty parenthesis lists are + not specified for attributes that have max_length > 0 (e.g. + [[attr()]]). + * cvt.c (maybe_warn_nodiscard): Add nodiscard message to + output, if applicable. + (convert_to_void): Allow constructors to be nodiscard-able (P1771). + +2019-10-18 Nathan Sidwell + + * cp-tree.h (struct lang_type): Remove was_anonymous. + (TYPE_WAS_UNNAMED): Implement by checking TYPE_DECL & + TYPE_STUB_DECL. + * decl.c (name_unnamed_type): Don't set TYPE_WAS_UNNAMED. + +2019-10-17 Paolo Carlini + + * decl.c (grokfndecl): Remove redundant use of in_system_header_at. + (compute_array_index_type_loc): Likewise. + (grokdeclarator): Likewise. + * error.c (cp_printer): Likewise. + * lambda.c (add_default_capture): Likewise. + * parser.c (cp_parser_primary_expression): Likewise. + (cp_parser_selection_statement): Likewise. + (cp_parser_toplevel_declaration): Likewise. + (cp_parser_enumerator_list): Likewise. + (cp_parser_using_declaration): Likewise. + (cp_parser_member_declaration): Likewise. + (cp_parser_exception_specification_opt): Likewise. + (cp_parser_std_attribute_spec): Likewise. + * pt.c (do_decl_instantiation): Likewise. + (do_type_instantiation): Likewise. + * typeck.c (cp_build_unary_op): Likewise. + + * decl.c (check_tag_decl): Pass to in_system_header_at the same + location used for the permerror. + (grokdeclarator): Likewise. + + * decl.c (check_tag_decl): Use locations[ds_typedef] in error_at. + 2019-10-17 Jason Merrill * cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var. @@ -20,6 +457,40 @@ * decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup, if cleanup is a nop, clear location of its operand too. +2019-10-15 Andrew Sutton + + Finish moving constraint and logic functionality of out pt.c. + Reimplement and re-enable subsumption caching. + + * config-lang.in (gtfiles): Add logic.cc. + * constraint.cc (atomic_constraints_identical_p): Add assertions. + (hash_atomic_constraint): Likewise. + (constraints_equivalent_p): New. + (inchash::add_constraint): New. + (iterative_hash_constraint): New. + (decl_constraints): Moved from pt.c. + (get_constraints): Likewise. + (set_constraints): Likewise. + (remove_constraints): Likewise. + * cp-tree.h (CONSTR_P): New. + (init_constraint_processing): Remove. + (constraints_equivalent_p, iterative_hash_constraint): Declare. + * decl.c (cxx_init_decl_processing): Don't initialize constraints. + * logic.cc (subsumption_entry): Moved from pt.c. + (subsumption_hasher): Likewise. + (subsumption_cache): Likewise. + (lookup_subsumption): Likewise. + (save_subsumption): Likewise. + (subsumes_constraints_nonnull): Use subsumption cache. + * pt.c: Move aforementioned declarations out of this file. + (init_constraint_processing): Remove. + +2019-10-15 Andrew Sutton + + * parser.c (cp_parser_constructor_declarator_p): Pass an empty + decl-specifier-seq to make sure we parse type constraints as part + of a type-specifier. + 2019-10-15 Nathan Sidwell * class.c (build_clones): Break out of clone_function_decl. Just