2019-12-30 Marek Polacek * decl.c (reshape_init_r): Remove assert. 2019-12-30 Paolo Carlini * decl2.c (delete_sanity): Add location_t parameter and use it throughout. * init.c (build_vec_delete_1): Likewise. (build_delete): Likewise. (build_vec_delete): Likewise. (perform_target_ctor): Adjust call. (perform_member_init): Likewise. (build_vec_init): Likewise. * decl.c (cxx_maybe_build_cleanup): Likewise. * pt.c (tsubst_copy_and_build): Likewise. * parser.c (cp_parser_delete_expression): Likewise, pass the combined_loc. * cp-tree.h: Update declarations. 2019-12-29 Marek Polacek PR c++/88337 - Implement P1327R1: Allow dynamic_cast in constexpr. * constexpr.c (cxx_dynamic_cast_fn_p): New function. (extract_obj_from_addr_offset): New function. (get_component_with_type): New function. (cxx_eval_dynamic_cast_fn): New function. (cxx_eval_call_expression): Call cxx_eval_dynamic_cast_fn for a call to __dynamic_cast. (potential_constant_expression_1): Don't give up on cxx_dynamic_cast_fn_p. * rtti.c (build_dynamic_cast_1): When creating a call to __dynamic_cast, use the location of the original expression. 2019-12-26 Jakub Jelinek PR c++/92438 * parser.c (cp_parser_constructor_declarator_p): If open paren is followed by RID_ATTRIBUTE, skip over the attribute tokens and try to parse type specifier. 2019-12-23 Richard Sandiford PR c++/92789 * typeck.c (structural_comptypes): Make sure that two vector types agree on gnu_vector_type_p. 2019-12-23 Richard Sandiford * cvt.c (ocp_convert): Apply rvalue to the source of vector conversions. * typeck.c (build_reinterpret_cast_1): Likewise. 2019-12-19 Marek Polacek PR c++/92745 - bogus error when initializing array of vectors. * decl.c (reshape_init_r): For a nested compound literal, do call reshape_init_{class,array,vector}. PR c++/92974 - bogus location for enum and non-enum in ?: warning. * tree.c (build_min_non_dep): Use the location of NON_DEP when building the expression. 2019-12-20 Jakub Jelinek PR c++/92965 * pt.c (invalid_nontype_parm_type_p): Call structural_type_p with explain=true only if emitting error. PR c++/92966 * method.c (early_check_defaulted_comparison): Don't set DECL_MAYBE_DELETED when returning false. PR c++/92973 * method.c (early_check_defaulted_comparison): For C++17 and earlier diagnose defaulted comparison operators. PR c++/92666 * call.c (convert_arg_to_ellipsis): For floating point or decltype(nullptr) arguments call mark_rvalue_use. PR c++/92992 * call.c (convert_arg_to_ellipsis): For decltype(nullptr) arguments that have side-effects use cp_build_compound_expr. 2019-12-20 Eric Botcazou * decl2.c (c_parse_final_cleanups): Always call collect_source_ref on the main input filename. 2019-12-19 Julian Brown Cesar Philippidis * parser.c (cp_parser_omp_clause_name): Support attach and detach clauses. (cp_parser_omp_var_list_no_open): Add ALLOW_DEREF optional parameter. Parse deref if true. (cp_parser_omp_var_list): Add ALLOW_DEREF optional parameter. Pass to cp_parser_omp_var_list_no_open. (cp_parser_oacc_data_clause): Support attach and detach clauses. Update call to cp_parser_omp_var_list_no_open. (cp_parser_oacc_all_clauses): Support attach and detach. (OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK, OACC_SERIAL_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_ATTACH. (OACC_EXIT_DATA_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_DETACH. * semantics.c (handle_omp_array_sections_1): Reject subarrays for attach and detach. (handle_omp_array_sections): Use GOMP_MAP_ATTACH_DETACH instead of GOMP_MAP_ALWAYS_POINTER for OpenACC. (cp_oacc_check_attachments): New function. (finish_omp_clauses): Use above function. Allow structure fields and class members to appear in OpenACC data clauses. Support GOMP_MAP_ATTACH_DETACH. Support deref. 2019-12-19 Jason Merrill PR c++/52320 - EH cleanups for partially constructed arrays. * typeck2.c (split_nonconstant_init_1): Add nested parm. Add cleanup for whole array if true. PR c++/66139 - EH cleanups for partially constructed aggregates. PR c++/57510 * cp-gimplify.c (cp_gimplify_init_expr): Use split_nonconstant_init. * typeck2.c (split_nonconstant_init): Handle non-variable dest. (split_nonconstant_init_1): Clear TREE_SIDE_EFFECTS. * tree.c (is_local_temp): New. 2019-12-18 Jason Merrill PR c++/91165 follow-on tweak * constexpr.c (cxx_eval_call_expression): Use unshare_expr_without_location. 2019-12-19 Julian Brown Maciej W. Rozycki Tobias Burnus Thomas Schwinge * parser.c (cp_parser_omp_clause_name): Support no_create. (cp_parser_oacc_data_clause): Likewise. (cp_parser_oacc_all_clauses): Likewise. (OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_PARALLEL_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_NO_CREATE. * semantics.c (handle_omp_array_sections): Support no_create. 2019-12-18 Paolo Carlini * typeck.c (cxx_sizeof_or_alignof_type): Add location_t parameter and use it throughout. (cxx_sizeof_expr): Likewise. (cxx_alignof_expr): Likewise. (cxx_sizeof_or_alignof_expr): Likewise. (cxx_alignas_expr): Update call. * decl.c (fold_sizeof_expr): Likewise. * pt.c (tsubst_copy): Likewise. (tsubst_copy_and_build): Likewise. * except.c (build_throw): Add location_t parameter and use it. (expand_end_catch_block): Update call. * parser.c (cp_parser_unary_expression): Update cxx_sizeof_or_alignof_type and cxx_sizeof_or_alignof_expr calls, pass the compound location. (cp_parser_throw_expression): Likewise pass the combined location to build_throw. * cp-tree.h: Update declarations. * semantics.c (finish_handler_parms): Use DECL_SOURCE_LOCATION. * decl2.c (check_classfn): Likewise. * except.c (is_admissible_throw_operand_or_catch_parameter): Exploit cp_expr_loc_or_input_loc in one place. * except.c (create_try_catch_expr): Remove, unused. 2019-12-17 Jason Merrill PR c++/12333 - X::~X() with implicit this->. * parser.c (cp_parser_lookup_name): Use lookup_destructor. * typeck.c (lookup_destructor): No longer static. 2019-12-17 Martin Sebor PR c++/61339 * parser.c (cp_parser_maybe_warn_enum_key): New function. (class_decl_loc_t): New class. (cp_parser_elaborated_type_specifier): Call cp_parser_maybe_warn_enum_key. (cp_parser_class_head): Call cp_parser_check_class_key. (cp_parser_check_class_key): Add arguments. Call class_decl_loc_t::add. (c_parse_file): Call class_decl_loc_t::diag_mismatched_tags. 2019-12-17 Jason Merrill PR c++/79592 - missing explanation of invalid constexpr. * constexpr.c (register_constexpr_fundef): Do store the body of a template instantiation that is not potentially constant. (explain_invalid_constexpr_fn): Look it up. (cxx_eval_call_expression): Check fundef->result. 2019-12-17 Jason Merrill PR c++/92576 - redeclaration of variable template. * decl.c (redeclaration_error_message): Recurse for variable templates. 2019-12-17 Jason Merrill * name-lookup.c (get_std_name_hint): Add std::byte. 2019-12-17 Jakub Jelinek PR c++/59655 * pt.c (push_tinst_level_loc): If limit_bad_template_recursion, set TREE_NO_WARNING on tldcl. * decl2.c (no_linkage_error): Treat templates with TREE_NO_WARNING as defined during error recovery. 2019-12-13 Jason Merrill PR c++/91165 - verify_gimple ICE with cached constexpr. * constexpr.c (cxx_bind_parameters_in_call): Don't unshare. (cxx_eval_call_expression): Unshare all args if we're caching. 2019-12-12 Jason Merrill PR c++/92496 - ICE with <=> and no #include . * typeck.c (cp_build_binary_op): Handle error from spaceship_type. 2019-12-11 David Malcolm * cxx-pretty-print.c (cxx_pretty_printer::clone): New vfunc implementation. * cxx-pretty-print.h (cxx_pretty_printer::clone): New vfunc decl. * error.c (cxx_format_postprocessor::clone): New vfunc. 2019-12-11 Jakub Jelinek PR c++/92869 * class.c (finish_struct): For C++17 and earlier, check type_has_user_provided_or_explicit_constructor rather than TYPE_HAS_USER_CONSTRUCTOR whether to set CLASSTYPE_NON_AGGREGATE. 2019-12-11 Marek Polacek PR c++/92878 - Parenthesized init of aggregates in new-expression. * init.c (build_new_1): Handle parenthesized initialization of aggregates in new-expression. 2019-12-11 Jason Merrill PR c++/92105 - decltype(decltype) error cascade. * parser.c (cp_parser_decltype_expr): Don't tentative_firewall here. (cp_parser_decltype): Do it here. Remember a non-tentative error. PR c++/57082 - new X{} and private destructor. * init.c (build_new_1): Also pass tf_no_cleanup to build_special_member_call. PR c++/92774 - ICE with implicitly deleted operator<=>. * method.c (comp_info::~comp_info): Factor out of... (build_comparison_op): Here. Handle error return from build_new_op. PR c++/92859 - ADL and bit-field. * name-lookup.c: Use unlowered_expr_type. PR c++/92446 - deduction of class NTTP. * pt.c (deducible_expression): Look through VIEW_CONVERT_EXPR. 2019-12-10 Jason Merrill PR c++/92847 - C++20 comparison ambiguity with class template. * call.c (cand_parms_match): Handle all templated functions. Fix C++20 structural type vs. private base. * class.c (build_base_field_1): Take access parameter. (build_base_field): Likewise. (build_base_fields, layout_virtual_bases): Pass it. * tree.c (structural_type_p): Improve private base diagnostic. PR c++/92560 - ICE with decltype and rewritten operator. * call.c (build_new_op_1): Clear tf_decltype on inner call. 2019-12-09 David Malcolm * error.c (range_label_for_type_mismatch::get_text): Replace label_text ctor calls with label_text::borrow. 2019-12-09 Paolo Carlini * typeck.c (check_for_casting_away_constness): Add location_t parameter and use it. (maybe_warn_about_useless_cast): Likewise. (maybe_warn_about_cast_ignoring_quals): Likewise. (build_static_cast_1): Likewise. (build_static_cast): Likewise; sets the location of the returned tree. (build_reinterpret_cast_1): Likewise. (build_reinterpret_cast): Likewise; sets the location of the returned tree. (build_const_cast_1): Likewise. (build_const_cast): Likewise; sets the location of the returned tree. (cp_build_c_cast): Likewise. (build_c_cast): Adjust. (build_ptrmemfunc): Adjust calls. (cp_build_unary_op): Pass the location to invert_truthvalue_loc. * rtti.c (build_dynamic_cast_1): Add location_t parameter and use it. (build_dynamic_cast): Likewise. * cp-tree.h: Adjust declarations. * parser.c (cp_parser_postfix_expression): Pass cp_cast_loc to the various build_*_cast functions. (get_cast_suggestion): Adjust calls. (cp_parser_builtin_offsetof): Likewise. * decl.c (reshape_init): Adjust call. * method.c (forward_parm): Likewise. (build_comparison_op): Likewise. * pt.c (tsubst_copy_and_build): Likewise. * semantics.c (finish_omp_reduction_clause): Likewise. (cp_omp_finish_iterators): Likewise. * tree.c (cp_stabilize_reference): Likewise. (move): Likewise. * typeck2.c (build_functional_cast): Likewise. * typeck2.c (build_functional_cast_1): New. (build_functional_cast_1): Calls the latter and sets the location of the returned tree. 2019-12-08 Jakub Jelinek * cvt.c (maybe_warn_nodiscard): Add workaround for GCC 3.4-4.4 - cast msg to (const char *) in conditional expressions. Formatting fixes. 2019-12-07 Jason Merrill Jakub Jelinek PR c++/92831 * call.c (build_conditional_expr_1): For ?: with omitted middle operand use cp_stabilize_reference if arg1 is glvalue_p rather than just if it is lvalue_p. 2019-12-06 Jakub Jelinek * parser.c (cp_parser_diagnose_invalid_type_name): Mention that concept is also available with -std=c++2a. PR c++/92831 - CWG 1299, not extending temporary lifetime for ?: * cp-tree.h (extend_ref_init_temps): Add a new argument with NULL default arg. * call.c (set_up_extended_ref_temp): Add COND_GUARD argument, pass it down to extend_ref_init_temps. Before pushing cleanup, if COND_GUARD is non-NULL, create a bool temporary if needed, initialize to false and guard the cleanup with the temporary being true. (extend_ref_init_temps_1): Add COND_GUARD argument, pass it down to recursive calls and set_up_extended_ref_temp. Handle COND_EXPR. (extend_ref_init_temps): Add COND_GUARD argument, pass it down to recursive calls and to extend_ref_init_temps_1. 2019-12-06 Richard Sandiford * decl.c (start_decl_1): Use verify_type_context to check whether the target allows variables of a particular type to have static or thread-local storage duration. (check_array_initializer): Use verify_type_context to check whether the target allows a particular type to be used as an array element. (create_array_type_for_decl): Likewise. (cp_finish_decl): Use verify_type_context to check whether the target allows static member variables of a particular type. (grokdeclarator): Likewise. Also use verify_type_context to check whether the target allows non-static member variables of a particular type. * except.c: Include target.h. (is_admissible_throw_operand_or_catch_parameter): Use verify_type_context to check whether the target allows particular types to be thrown and caught. * typeck2.c (add_exception_specifier): Likewise. * init.c (build_new_1): Use verify_type_context to check whether the target allows particular types to be dynamically allocated. (build_vec_delete_1, build_delete): Use verify_type_context to check whether the target allows particular types to be deleted. * lambda.c (add_capture): Use verify_type_context to check whether the target allows particular types to be captured by copy. * pt.c: Include target.h. (instantiate_class_template_1): Use verify_type_context to check whether the target allows non-static member variables of a particular type. * typeck.c (cxx_alignof_expr): Use verify_type_context to check whether the target allows the alignment of a particular type to be measured. (pointer_diff, cp_build_unary_op): Use verify_type_context to check whether the target allows arithmetic involving pointers to particular types. 2019-12-05 Marek Polacek Jakub Jelinek PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts. * class.c (trivial_default_constructor_is_constexpr): Return true in C++20. * constexpr.c (cx_check_missing_mem_inits): Allow missing field initializers in C++20. (cxx_eval_call_expression): Don't clear CONSTRUCTOR_NO_CLEARING for constexpr constructors in C++20. (reduced_constant_expression_p): Don't set FIELD for union and array types. Skip empty class fields without initializers. * decl.c (check_for_uninitialized_const_var): Permit trivial default initialization in constexpr. (next_initializable_field): Don't skip vptr fields. * method.c (walk_field_subobs): Still consider a constructor that doesn't initialize all the members constexpr. 2019-12-05 Marek Polacek PR c++/92271 - make __is_same alias for __is_same_as. * cxx-pretty-print.c (pp_cxx_trait_expression) : Print "__is_same". 2019-12-05 David Edelsohn * cp-gimplify.c: Include memmodel.h. 2019-12-05 Paolo Carlini * typeck2.c (build_functional_cast): Add location_t parameter and use it. * cp-tree.h: Update declaration. * parser.c (cp_parser_functional_cast): Adjust call. * call.c (build_op_delete_call): Likewise. (build_new_method_call_1): Likewise. * decl.c (check_initializer): Likewise. * pt.c (tsubst_copy_and_build): Likewise. * semantics.c (finish_compound_literal): Likewise. 2019-12-04 David Edelsohn * cp-gimplify.c: Include tm_p.h. 2019-12-04 Marek Polacek * parser.c (enum primary_constraint_error): Remove stray comma. 2019-12-04 Richard Sandiford * cp-tree.h (CP_AGGREGATE_TYPE_P): Check for gnu_vector_type_p instead of VECTOR_TYPE. * call.c (build_conditional_expr_1): Restrict vector handling to vectors that satisfy gnu_vector_type_p. * cvt.c (ocp_convert): Only allow vectors to be converted to bool if they satisfy gnu_vector_type_p. (build_expr_type_conversion): Only allow conversions from vectors if they satisfy gnu_vector_type_p. * typeck.c (cp_build_binary_op): Only allow binary operators to be applied to vectors if they satisfy gnu_vector_type_p. (cp_build_unary_op): Likewise unary operators. (build_reinterpret_cast_1): 2019-12-03 Jakub Jelinek * cp-tree.h (enum cp_tree_index): Add CPTI_SOURCE_LOCATION_IMPL. (source_location_impl): Define. (enum cp_built_in_function): Add CP_BUILT_IN_SOURCE_LOCATION. (fold_builtin_source_location): Declare. * cp-gimplify.c: Include output.h, file-prefix-map.h and cgraph.h. (cp_gimplify_expr, cp_fold): Handle CP_BUILT_IN_SOURCE_LOCATION. Formatting fix. (get_source_location_impl_type): New function. (struct source_location_table_entry, struct source_location_table_entry_hash): New types. (source_location_table, source_location_id): New variables. (fold_builtin_source_location): New function. * constexpr.c (cxx_eval_builtin_function_call): Handle CP_BUILT_IN_SOURCE_LOCATION. * tree.c (builtin_valid_in_constant_expr_p): Likewise. Formatting fix. * decl.c (cxx_init_decl_processing): Register __builtin_source_location. * name-lookup.c (get_std_name_hint): Add source_location entry. 2019-12-03 Paolo Carlini * typeck.c (cp_build_addr_expr_1): Use the cp_expr_loc_or_input_loc location in a few additional diagnostics; tidy. (check_return_expr): Likewise. * typeck.c (cp_build_addr_expr_1): Use tree_strip_any_location_wrapper for the address of main pedwarn. 2019-12-03 Jakub Jelinek PR c++/91369 * constexpr.c (struct constexpr_global_ctx): Add cleanups member, initialize it in the ctor. (cxx_eval_constant_expression) : If TARGET_EXPR_SLOT is already in the values hash_map, don't evaluate it again. Put TARGET_EXPR_SLOT into hash_map even if not lval, and push it into save_exprs too. If there is TARGET_EXPR_CLEANUP and not CLEANUP_EH_ONLY, push the cleanup to cleanups vector. : Save outer cleanups, set cleanups to local auto_vec, after evaluating the body evaluate cleanups and restore previous cleanups. : Don't crash if the first operand is NULL_TREE. (cxx_eval_outermost_constant_expr): Set cleanups to local auto_vec, after evaluating the expression evaluate cleanups. 2019-12-03 Marek Polacek PR c++/91363 - P0960R3: Parenthesized initialization of aggregates. * call.c (build_new_method_call_1): Handle parenthesized initialization of aggregates by building up a CONSTRUCTOR. (extend_ref_init_temps): Do nothing for CONSTRUCTOR_IS_PAREN_INIT. * cp-tree.h (CONSTRUCTOR_IS_PAREN_INIT, LOOKUP_AGGREGATE_PAREN_INIT): Define. * decl.c (grok_reference_init): Handle aggregate initialization from a parenthesized list of values. (reshape_init): Do nothing for CONSTRUCTOR_IS_PAREN_INIT. (check_initializer): Handle initialization of an array from a parenthesized list of values. Use NULL_TREE instead of NULL. * tree.c (build_cplus_new): Handle BRACE_ENCLOSED_INITIALIZER_P. * typeck2.c (digest_init_r): Set LOOKUP_AGGREGATE_PAREN_INIT if it receives a CONSTRUCTOR with CONSTRUCTOR_IS_PAREN_INIT set. Allow narrowing when LOOKUP_AGGREGATE_PAREN_INIT. (massage_init_elt): Don't lose LOOKUP_AGGREGATE_PAREN_INIT when passing flags to digest_init_r. 2019-12-03 Jakub Jelinek PR c++/92732 * typeck2.c (digest_nsdmi_init): For bitfields, use DECL_BIT_FIELD_TYPE instead of TREE_TYPE. 2019-12-03 Jason Merrill Jakub Jelinek PR c++/92705 * call.c (strip_standard_conversion): New function. (build_new_op_1): Use it for user_conv_p. (compare_ics): Likewise. (source_type): Likewise. 2019-12-03 Jakub Jelinek PR c++/92695 * constexpr.c (cxx_bind_parameters_in_call): For virtual calls, adjust the first argument to point to the derived object rather than its base. 2019-12-02 Jakub Jelinek PR c++/92695 * constexpr.c (cxx_eval_constant_expression) : Use STRIP_NOPS before checking for ADDR_EXPR. 2019-11-29 Jakub Jelinek PR c++/60228 * parser.c (cp_parser_omp_declare_reduction_exprs): If processing_template_decl, wrap the combiner or initializer into EXPR_STMT. * decl.c (start_preparsed_function): Don't start a lambda scope for DECL_OMP_DECLARE_REDUCTION_P functions. (finish_function): Don't finish a lambda scope for DECL_OMP_DECLARE_REDUCTION_P functions, nor cp_fold_function them nor cp_genericize them. * mangle.c (decl_mangling_context): Look through DECL_OMP_DECLARE_REDUCTION_P functions. * semantics.c (expand_or_defer_fn_1): For DECL_OMP_DECLARE_REDUCTION_P functions, use tentative linkage, don't keep their bodies with -fkeep-inline-functions and return false at the end. 2019-11-28 Jakub Jelinek PR c++/92695 * decl2.c (mark_used): Don't call note_vague_linkage_fn for pure virtual functions, even if they are declared inline. 2019-11-16 Jason Merrill Implement P1814R0, CTAD for alias templates. * pt.c (rewrite_tparm_list): Factor out of build_deduction_guide. (maybe_aggr_guide): Check for copy-init here. (alias_ctad_tweaks, deduction_guides_for): New. (ctor_deduction_guides_for): Factor out of do_class_deduction. (ctad_template_p): New. * parser.c (cp_parser_simple_type_specifier): Use it. * constraint.cc (append_constraint): New. 2019-11-16 Jason Merrill * cxx-pretty-print.c (pp_cxx_unqualified_id): Handle alias template-id. * pt.c (complex_alias_template_p): True if constraints. (get_underlying_template, tsubst): Check alias constraints. (push_template_decl_real): Set alias constraints here. * parser.c (cp_parser_alias_declaration): Not here. * constraint.cc (get_constraints): Take const_tree. 2019-11-12 Jason Merrill PR c++/92206 - ICE with typedef to dependent alias. * pt.c (dependent_alias_template_spec_p) (alias_template_specialization_p): Add transparent_typedefs parameter. (iterative_hash_template_arg, any_template_parm_r) (primary_template_specialization_p, tsubst, dependent_type_p_r): Adjust. * decl.c (check_elaborated_type_specifier): Adjust. * error.c (dump_template_bindings, dump_aggr_type): Adjust. 2019-11-27 Andrew Sutton PR c++/92236 Defer evaluation of concept checks so that static assertions can emit more detailed diagnostics. * constexpr.c (cxx_eval_call_expression): Handle concept checks. (cxx_eval_constant_expression): Diagnose misuse of function concepts as template-id expressions. Follow the usual return path for results. (cxx_eval_outermost_constant_expr): Avoid calling cp_get_callee_fndecl_nofold for function concepts. * constraint.cc (build_function_check): Fully type the concept check so that we don't ICE in conversions. * cp-gimplify.c (cp_genericize_r) [CALL_EXPR]: Handle concept checks. [TEMPLATE_ID_EXPR] Likewise. * cvt.c (convert_to_void): Always evaluate concept checks so we don't accidentally ignore them. Substitution during satisfaction can make a program ill-formed (example in g++.dg/cpp2a/concepts6.C). * pt.c (tsubst_copy_and_build): [CALL_EXPR]: Don't evaluate concepts. [TEMPLATE_ID_EXPR]: Likewise. * semantics.c (finish_call_expr): Don't evaluate concepts. (finish_id_expression_1): Likewise. (finish_static_assert): Preserve the original condition so we can diagnose concept errors when a check returns false. 2019-11-27 Andrew Sutton PR c++/92439 Improve quality of diagnostics for subexpressions that need parens. * parser.c (cp_parser_requires_clause_opt): Add a flag to indicate when parsing a requires-clause before lambda parameters, and... (cp_parser_lambda_declarator_opt): ... use that here ... (cp_parser_type_parameter): ... and here ... (cp_parser_late_return_type_opt): ... and here ... (cp_parser_explicit_template_declaration): ... and here. (cp_parser_diagnose_ungrouped_constraint_plain): Adjust the message because this can apply to subexpressions that are not immediately after a requires-clause. (cp_parser_diagnose_ungrouped_constraint_rich): Likewise. (primary_constraint_error): New. (cp_parser_constraint_requires_parens): New. (cp_parser_unary_constraint_requires_parens): New. (cp_parser_constraint_primary_expression): Check for unary expressions before parsing the primary expression. Also check for binary and postfix operators after a successful parse of the primary expression. Force a re-parse if the result would form a lower-precedence string. (cp_parser_constraint_logical_and_expression): Propagate lambda flag; move checks for ill-formed constraints into the constraint primary expression. (cp_parser_constraint_logical_or_expression): Likewise. (cp_parser_requires_clause_expression): Propagate lambda flag. 2019-11-27 Andrew Sutton PR c++/88395 * constraint.cc (satisfy_declaration_constraints): Push tinst levels around satisfaction. 2019-11-27 Andrew Sutton Diagnose certain constraint errors as hard errors, but otherwise treat them the same as normal SFINAE-type errors. Also, generally clean up the satisfaction functions. * constexpr.c (cxx_eval_constant_expression): Use evaluate_concept_check. * constraint.cc (normalize_concept_definition): Accept a diagnostic flag and only cache when not diagnosing errors. (decl_satisfied_cache): Map to trees instead of bools. (satisfy_atom): Guarantee a location for the errors, propagate complain flags to force_rvalue, and emit errors for non-boolean constraints. (get_normalized_constraints_and_args): New overloads. Factored out of satisfy_constraint_expression and satisfy_declaration_constraints. (satisfy_constraint_expression): Propagate diagnostic info to normalization. (satisfy_declaration_constraints): New. Factored out of constraints_satisfied_p. (constraint_satisfaction_value): New. Calls satisfy_constraint_expression or satisfy_declaration_constraints. (constraints_satisfied_p): Call constraint_satisfaction_value. (evaluate_concept_check): Don't take tsubst_falgs_t. Replay satisfaction if an error is encountered. (current_failed_constraint): Moved from pt.c. (diagnose_constraints): Call constraint_satisfaction_value. * cp-tree.h: Update declarations. * pt.c (current_failed_constraint): Moved to constraint.cc. * semantics.c (finish_id_expression_1): Remove a duplicate case. 2019-11-27 Jakub Jelinek PR c++/92524 * tree.c (replace_placeholders_r): Don't walk constructor elts with RANGE_EXPR indexes. 2019-11-26 Jason Merrill * pt.c (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Remember the location of a variable template-id. * constexpr.c (cxx_eval_constant_expression): Get expr location before stripping location wrappers. (non_const_var_error): Take location argument. 2019-11-26 Paolo Carlini * typeck.c (cp_build_unary_op): Consistently use the accurate location in seven additional diagnostic messages. (cp_build_compound_expr): Use cp_expr_loc_or_input_loc in one place. 2019-11-26 Jakub Jelinek PR c++/92648 * parser.c (cp_parser_std_attribute): For unknown attributes, skip balanced token seq instead of trying to parse attribute-argument-clause as expression list. Formatting fix. PR c++/61414 * class.c (enum_to_min_precision): New hash_map. (enum_min_precision): New function. (check_bitfield_decl): Use it. 2019-11-25 Paolo Carlini * typeck.c (cp_build_indirect_ref_1): Add location_t parameter and use it in error messages. (build_x_indirect_ref): Adjust call. (build_indirect_ref): Likewise. (cp_build_fold_indirect_ref): Likewise. (cp_build_array_ref): Likewise. * call.c (build_new_op_1): Likewise. * semantics.c (finish_omp_clauses): Likewise. (finish_omp_depobj): Likewise. * typeck2.c (build_x_arrow): Likewise. * cp-tree.h (cp_build_indirect_ref): Update declaration. * call.c (build_new_op_1): Use location argument in warning_at. * typeck.c (cp_build_modify_expr): Consistently use the location_t argument. 2019-11-23 Bernd Edlinger PR c++/92365 * name-lookup.c (check_local_shadow): Use can_convert_arg instead of can_convert. 2019-11-22 Marek Polacek PR c++/88337 - P1327R1: Allow polymorphic typeid in constexpr. * constexpr.c (potential_constant_expression_1): Allow a typeid expression whose operand is of polymorphic type in constexpr in C++20. * rtti.c (build_typeid): Remove obsolete FIXME comment. 2019-11-22 Jakub Jelinek PR c/90677 * cp-objcp-common.c (identifier_global_tag): Define. PR c++/92458 * init.c (nsdmi_inst): Change type to decl_tree_cache_map * from tree_cache_map *. * constraint.cc (decl_constraints): Likewise. * decl.c (get_tuple_decomp_init): Likewise. * pt.c (defarg_inst, explicit_specifier_map): Likewise. (tsubst_default_argument, store_explicit_specifier): Use decl_tree_cache_map::create_ggc rather than tree_cache_map::create_ggc. * cp-objcp-common.c (debug_type_map): Change type to type_tree_cache_map * from tree_cache_map *. 2019-11-21 Marek Polacek PR c++/92450 - ICE with invalid nested name specifier. * parser.c (cp_parser_member_declaration): Don't attempt to print erroneous bit-field diagnostic if grokdeclarator returns error_mark_node. 2019-11-21 Jakub Jelinek Jason Merrill PR c++/90842 * parser.c (cp_parser_decl_specifier_seq): For concept or typedef break early if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR. For type specifiers, set CP_PARSER_FLAGS_NO_TYPE_DEFINITIONS if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR is set. 2019-11-20 Paolo Carlini * typeck2.c (build_x_arrow): Early return if decay_conversion returns error_mark_node. 2019-11-20 Jakub Jelinek PR c++/90767 * call.c (complain_about_no_candidates_for_method_call): If conv->from is not a type, pass to complain_about_bad_argument lvalue_type of conv->from. 2019-11-20 Paolo Carlini * cvt.c (ocp_convert): Use additional warning sentinel. 2019-11-19 Jakub Jelinek PR c++/92414 * constexpr.c (cxx_eval_outermost_constant_expr): If DECL_INITIAL on object is erroneous, return t without trying to evaluate a constexpr dtor. 2019-11-12 Jason Merrill * call.c (same_fn_or_template): Change to cand_parms_match. (joust): Adjust. (print_z_candidate): Mark rewritten/reversed candidates. (build_new_op_1): Warn about recursive call with reversed arguments. 2019-11-15 Andrew Sutton PR c++/89913 * pt.c (get_underlying_template): Exit loop if the original type of the alias is null. 2019-11-19 Andrew Sutton PR c++/92078 * pt.c (maybe_new_partial_specialization): Apply access to newly created partial specializations. Update comment style. 2019-11-19 Andrew Sutton PR c++/92078 * pt.c (maybe_new_partial_specialization): Apply access to newly created partial specializations. Update comment style. 2019-11-19 Andrew Sutton PR c++/92403 Suppress diagnostics substituting into a requires-expression. * pt.c (tsubst_copy_and_build): Perform the first substitution without diagnostics and a second only if tsubst_requries_expr returns an error. 2019-11-19 Jakub Jelinek PR c++/92504 * semantics.c (handle_omp_for_class_iterator): Don't call cp_fully_fold on cond. 2019-11-18 Paolo Carlini * typeck.c (cp_build_addr_expr_1): Use cp_expr_loc_or_input_loc in three places. (cxx_sizeof_expr): Use it in one additional place. (cxx_alignof_expr): Likewise. (lvalue_or_else): Likewise. 2019-11-18 Marek Polacek PR c++/91962 - ICE with reference binding and qualification conversion. * call.c (convert_like_real) : Check need_temporary_p. 2019-11-17 Jakub Jelinek * method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%> to print the decl. (lookup_comparison_category): Use %qD instead of % to print the decl. 2019-11-15 Paolo Carlini * typeck.c (cp_truthvalue_conversion): Add tsubst_flags_t parameter and use it in calls; also pass the location_t of the expression to cp_build_binary_op and c_common_truthvalue_conversion. * rtti.c (build_dynamic_cast_1): Adjust call. * cvt.c (ocp_convert): Likewise. * cp-gimplify.c (cp_fold): Likewise. * cp-tree.h (cp_truthvalue_conversion): Update declaration. 2019-11-14 Jason Merrill Implement P1816R0, class template argument deduction for aggregates. * pt.c (maybe_aggr_guide, collect_ctor_idx_types): New. (is_spec_or_derived): Split out from do_class_deduction. (build_deduction_guide): Handle aggregate guide. * class.c (finish_struct): Set CLASSTYPE_NON_AGGREGATE in a template. * cp-tree.h (CP_AGGREGATE_TYPE_P): An incomplete class is not an aggregate. 2019-11-14 Richard Sandiford * call.c (build_conditional_expr_1): Use truth_type_for instead of build_same_sized_truth_vector_type. * typeck.c (build_vec_cmp): Likewise. 2019-11-14 Jakub Jelinek * parser.c (cp_parser_omp_context_selector): Don't require score argument to fit into shwi, just to be INTEGER_CST. Diagnose negative score. * pt.c (tsubst_attribute): Likewise. * parser.c (cp_parser_omp_context_selector): Rename CTX_PROPERTY_IDLIST to CTX_PROPERTY_NAME_LIST, add CTX_PROPERTY_ID. Use CTX_PROPERTY_ID for atomic_default_mem_order, only allow a single identifier in that. For CTX_PROPERTY_NAME_LIST, allow identifiers and string literals. * pt.c (tsubst_attribute): Fix up STRING_CST handling if allow_string. 2019-11-13 Marek Polacek PR c++/89070 - bogus [[nodiscard]] warning in SFINAE. * cvt.c (convert_to_void): Guard maybe_warn_nodiscard calls with tf_warning. 2019-11-13 Richard Sandiford PR c++/92206 * cp-tree.h (STF_STRIP_DEPENDENT): New constant. * tree.c (strip_typedefs): Add STF_STRIP_DEPENDENT to the flags when calling strip_typedefs recursively on a DECL_ORIGINAL_TYPE. Don't apply the fix for DR1558 in that case; allow aliases with dependent template parameters to be stripped instead. 2019-11-12 Nathan Sidwell * name-lookup.c (lookup_using_decl): New function, merged from ... (do_class_using_decl): ... here. Call it. And ... (finish_nonmember_using_decl): ... here. Call it. 2019-11-12 Martin Liska * name-lookup.c: Do not include params.h. * typeck.c: Likewise. 2019-11-12 Martin Liska * name-lookup.c (namespace_hints::namespace_hints): Replace old parameter syntax with the new one, include opts.h if needed. Use SET_OPTION_IF_UNSET macro. * typeck.c (comptypes): Likewise. 2019-11-12 Maciej W. Rozycki Frederik Harwath gcc/cp/ * constexpr.c (potential_constant_expression_1): Handle OACC_SERIAL. * parser.c (OACC_SERIAL_CLAUSE_MASK): New macro. (cp_parser_oacc_kernels_parallel): Rename function to... (cp_parser_oacc_compute): ... this. Handle PRAGMA_OACC_SERIAL. (cp_parser_omp_construct): Update accordingly. (cp_parser_pragma): Handle PRAGMA_OACC_SERIAL. Fix alphabetic order. * pt.c (tsubst_expr): Handle OACC_SERIAL. 2019-11-11 Jason Merrill Implement P1946R0, Allow defaulting comparisons by value. * method.c (early_check_defaulted_comparison): Accept by-value, reject mixed by-value and by-reference parms. * decl.c (grokdeclarator): Set funcdef_flag for defaulted friend. * decl2.c (grokfield): Don't SET_DECL_FRIEND_CONTEXT. * typeck.c (cp_build_binary_op): Sorry about <=> on VECTOR_TYPE. 2019-11-11 Jakub Jelinek PR c++/92447 * decl.c (finish_function): Move ctype initialization before DECL_DELETED_FN handling. * semantics.c (finish_translation_unit): Diagnose declare target without corresponding end declare target. 2019-11-10 Jason Merrill Implement D1957R0, T* to bool should be considered narrowing. * typeck2.c (check_narrowing): Treat pointer->bool as a narrowing conversion with -std=c++2a. 2019-11-08 Marek Polacek PR c++/92215 - flawed diagnostic for bit-field with non-integral type. * parser.c (cp_parser_member_declaration): Add a diagnostic for bit-fields with non-integral types. 2019-11-08 Jakub Jelinek * init.c (build_vec_delete_1): Fix a comment typo - mist -> must. 2019-11-07 Jason Merrill Implement D1959R0, remove weak_equality and strong_equality. * method.c (enum comp_cat_tag, comp_cat_info): Remove *_equality. (genericize_spaceship, common_comparison_type): Likewise. * typeck.c (cp_build_binary_op): Move SPACESHIP_EXPR to be with the relational operators, exclude other types no longer supported. 2019-11-06 Jason Merrill Implement D1907R1 "structural type". * tree.c (structural_type_p): New. * pt.c (invalid_nontype_parm_type_p): Use it. * class.c (build_base_field_1): Take binfo. Copy TREE_PRIVATE. (build_base_field): Pass binfo. PR c++/92150 - partial specialization with class NTTP. * pt.c (unify): Handle VIEW_CONVERT_EXPR. * pt.c (use_pack_expansion_extra_args_p): Still do substitution if all packs are simple pack expansions. (add_extra_args): Check that the extra args aren't dependent. 2019-11-06 Andrew Sutton Use satisfaction with nested requirements. * constraint.cc (build_parameter_mapping): Use current_template_parms when the declaration is not available. (norm_info::norm_info) Make explicit. (normalize_constraint_expression): Factor into a separate overload that takes arguments, and use that in the original function. (tsubst_nested_requirement): Use satisfy_constraint instead of trying to evaluate this as a constant expression. (finish_nested_requirement): Keep the normalized constraint and the original normalization arguments with the requirement. (diagnose_nested_requirement): Use satisfy_constraint. Tentatively implement more comprehensive diagnostics, but do not enable. * parser.c (cp_parser_requires_expression): Relax requirement that requires-expressions can live only inside templates. * pt.c (any_template_parm_r): Look into type of PARM_DECL. 2019-11-06 Jason Merrill C++20 NB CA378 - Remove constrained non-template functions. * decl.c (grokfndecl): Reject constraints on non-templated function. 2019-11-06 Matthias Kretz * parser.c (cp_parser_operator): Parse operator?: as an attempt to overload the conditional operator. 2019-11-05 Jason Merrill Implement C++20 operator<=>. * cp-tree.h (struct lang_decl_fn): Add maybe_deleted bitfield. (DECL_MAYBE_DELETED): New. (enum special_function_kind): Add sfk_comparison. (LOOKUP_REWRITTEN, LOOKUP_REVERSED): New. * call.c (struct z_candidate): Add rewritten and reversed methods. (add_builtin_candidate): Handle SPACESHIP_EXPR. (add_builtin_candidates): Likewise. (add_candidates): Don't add a reversed candidate if the parms are the same. (add_operator_candidates): Split out from build_new_op_1. Handle rewritten and reversed candidates. (add_candidate): Swap conversions of reversed candidate. (build_new_op_1): Swap them back. Build a second operation for rewritten candidates. (extract_call_expr): Handle rewritten calls. (same_fn_or_template): New. (joust): Handle rewritten and reversed candidates. * class.c (add_implicitly_declared_members): Add implicit op==. (classtype_has_op, classtype_has_defaulted_op): New. * constexpr.c (cxx_eval_binary_expression): Handle SPACESHIP_EXPR. (cxx_eval_constant_expression, potential_constant_expression_1): Likewise. * cp-gimplify.c (genericize_spaceship): New. (cp_genericize_r): Use it. * cp-objcp-common.c (cp_common_init_ts): Handle SPACESHIP_EXPR. * decl.c (finish_function): Handle deleted function. * decl2.c (grokfield): SET_DECL_FRIEND_CONTEXT on defaulted friend. (mark_used): Check DECL_MAYBE_DELETED. Remove assumption that defaulted functions are non-static members. * error.c (dump_expr): Handle SPACESHIP_EXPR. * method.c (type_has_trivial_fn): False for sfk_comparison. (enum comp_cat_tag, struct comp_cat_info_t): New types. (comp_cat_cache): New array variable. (lookup_comparison_result, lookup_comparison_category) (is_cat, cat_tag_for, spaceship_comp_cat) (spaceship_type, genericize_spaceship) (common_comparison_type, early_check_defaulted_comparison) (comp_info, build_comparison_op): New. (synthesize_method): Handle sfk_comparison. Handle deleted. (get_defaulted_eh_spec, maybe_explain_implicit_delete) (explain_implicit_non_constexpr, implicitly_declare_fn) (defaulted_late_check, defaultable_fn_check): Handle sfk_comparison. * name-lookup.c (get_std_name_hint): Add comparison categories. * tree.c (special_function_p): Add sfk_comparison. * typeck.c (cp_build_binary_op): Handle SPACESHIP_EXPR. 2019-11-05 Tim van Deurzen Add new tree code for the spaceship operator. * cp-tree.def: Add new tree code. * operators.def: New binary operator. * parser.c: Add new token and tree code. 2019-09-15 Jason Merrill * call.c (build_new_op_1): Don't apply any standard conversions to the operands of a built-in operator. Don't suppress conversions in cp_build_unary_op. * typeck.c (cp_build_unary_op): Do integral promotions for enums. 2019-11-04 Jason Merrill Use vec instead of raw array for built-in candidates. * call.c (build_builtin_candidate): Take args in a vec. (add_builtin_candidate, add_builtin_candidates): Likewise. (build_conditional_expr_1, build_new_op_1): Adjust. 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. (gimplify_to_rvalue): Remove default NULL argument. 2019-10-17 Nathan Sidwell * decl.c (builtin_function_1): Merge into ... (cxx_builtin_function): ... here. Nadger the decl before maybe copying it. Set the context. (cxx_builtin_function_ext_scope): Push to top level, then call cxx_builtin_function. 2019-10-16 Luis Machado * cp-gimplify.c: Fix reference to non-existing tree-gimple.c file. 2019-10-16 Jakub Jelinek * 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 build the clones. (clone_function_decl): Call build_clones, then maybe add them to the method vector. * class.c (build_clone): Refactor to clarify recursiveness. 2019-10-14 Jason Merrill PR c++/91930 - ICE with constrained inherited default ctor. * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR for inherited constructor. 2019-10-14 Paolo Carlini * decl.c (check_tag_decl): Use DECL_SOURCE_LOCATION. 2019-10-14 Jakub Jelinek PR c++/92084 * semantics.c (handle_omp_array_sections_1): Temporarily disable -fstrong-eval-order also for in_reduction and task_reduction clauses. * parser.c (cp_parser_omp_all_clauses): Change bool NESTED_P argument into int NESTED, if it is 2, diagnose missing commas in between clauses. (cp_parser_omp_context_selector): Pass 2 as last argument to cp_parser_omp_all_clauses. 2019-10-12 Jakub Jelinek * parser.c (cp_parser_omp_context_selector): Improve error recovery. For simd properties, put them directly into TREE_VALUE. (cp_finish_omp_declare_variant): Add "omp declare variant base" attribute rather than "omp declare variant". 2019-10-11 Marek Polacek PR c++/92049 - extra error with -fchecking=2. * pt.c (build_non_dependent_expr): Call fold_non_dependent_expr with tf_none. 2019-10-11 Paolo Carlini * typeck.c (cp_build_binary_op): Do not handle RROTATE_EXPR and LROTATE_EXPR. * constexpr.c (cxx_eval_constant_expression): Likewise. (potential_constant_expression_1): Likewise. * pt.c (tsubst_copy): Likewise. 2019-10-11 Jason Merrill * decl2.c (mark_used): Don't clobber DECL_SOURCE_LOCATION on explicitly defaulted functions. * method.c (synthesize_method): Likewise. 2019-10-11 Jakub Jelinek PR c++/91987 * decl2.c (grok_array_decl): For -fstrong-eval-order, when array ref operands have been swapped and at least one operand has side-effects, revert the swapping before calling build_array_ref. * typeck.c (cp_build_array_ref): For non-ARRAY_TYPE array ref with side-effects on the index operand, if -fstrong-eval-order use save_expr around the array operand. (cp_build_binary_op): For shifts with side-effects in the second operand, wrap first operand into SAVE_EXPR and evaluate it before the shift. * semantics.c (handle_omp_array_sections_1): Temporarily disable flag_strong_eval_order during OMP_CLAUSE_REDUCTION array section processing. * cp-gimplify.c (gimplify_to_rvalue): New function. (cp_gimplify_expr): Use it. 2019-10-10 Marek Polacek * typeck.c (comp_ptr_ttypes_real): Change the return type to bool. Use false instead of 0. 2019-10-10 Jakub Jelinek * parser.h (struct cp_omp_declare_simd_data): Add variant_p member. * parser.c (cp_ensure_no_omp_declare_simd): Handle both declare simd and declare variant. (cp_parser_oacc_all_clauses): Formatting fix. (cp_parser_omp_all_clauses): Add NESTED_P argument, if true, terminate processing on closing paren and don't skip to end of pragma line. (cp_parser_omp_declare_simd): Add VARIANT_P argument. Handle also declare variant. (omp_construct_selectors, omp_device_selectors, omp_implementation_selectors, omp_user_selectors): New variables. (cp_parser_omp_context_selector, cp_parser_omp_context_selector_specification, cp_finish_omp_declare_variant): New functions. (cp_parser_late_parsing_omp_declare_simd): Handle also declare variant. (cp_parser_omp_declare): Handle declare variant. 2019-10-09 Jason Merrill * cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING. 2019-10-09 Marek Polacek PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound. PR c++/69531 - DR 1307: Differently bounded array parameters. PR c++/88128 - DR 330: Qual convs and pointers to arrays of pointers. * call.c (build_array_conv): Build ck_identity at the beginning of the conversion. (standard_conversion): Pass bounds_none to comp_ptr_ttypes_const. (maybe_warn_array_conv): New. (convert_like_real): Call it. Add an error message about converting from arrays of unknown bounds. (conv_get_original_expr): New. (nelts_initialized_by_list_init): New. (conv_binds_to_array_of_unknown_bound): New. (compare_ics): Implement list-initialization ranking based on array sizes, as specified in DR 1307 and P0388R. * cp-tree.h (comp_ptr_ttypes_const): Adjust declaration. (compare_bounds_t): New enum. * typeck.c (comp_array_types): New bool and compare_bounds_t parameters. Use them. (structural_comptypes): Adjust the call to comp_array_types. (similar_type_p): Handle ARRAY_TYPE. (build_const_cast_1): Pass bounds_none to comp_ptr_ttypes_const. (comp_ptr_ttypes_real): Don't check cv-quals of ARRAY_TYPEs. Use comp_array_types to compare array types. Look through arrays as per DR 330. (comp_ptr_ttypes_const): Use comp_array_types to compare array types. Look through arrays as per DR 330. 2019-10-09 Marek Polacek PR c++/92032 - DR 1601: Promotion of enum with fixed underlying type. * call.c (standard_conversion): When converting an enumeration with a fixed underlying type to the underlying type, give it the cr_promotion rank. (compare_ics): Implement a tiebreaker as per CWG 1601. 2019-10-08 Andrew Sutton Jason Merrill Update the concepts implementation to conform to the C++20 specification, improve compile times, and generally clean up the implementation. * call.c (build_new_function_call): Don't evaluate concepts here. (constraint_failure): Don't record the template. (print_z_candidate): Don't extract the template. * class.c (add_method): When overloading, hide ineligible special member fns. (check_methods): Set TYPE_HAS_COMPLEX_* here. * constexpr.c (cxx_eval_constant_expression): Evaluate concepts. (maybe_initialize_fundef_copies_table): Remove. (get_fundef_copy): Use hash_map_safe_get_or_insert. (clear_cv_and_fold_caches): Clear the satisfaction cache. * constraint.cc (known_non_bool_p): New. (parsing_constraint_expression_sentinel): Renamed from expanding_constraint_sentinel. (check_constraint_operands): New. (check_constraint_atom): New. (finish_constraint_binary_op): New. (finish_constraint_or_expr): Likewise. (finish_constraint_and_expr): Likewise. (finish_constraint_primary_expr): Likewise. (combine_constraint_expressions): New. (finish_requires_expr): Add location parm. (get_concept_definition): Return the initializer of concept definitions. (get_template_head_requirements): New. (get_trailing_function_requirements): New. (deduce_constrained_parameter): Check if the identifier or template-id is a concept definition. (resolve_concept_definition_check): Removed. (resolve_variable_concept_check): Removed. (resolve_concept_check): New. (resolve_constraint_check): Handle concept definitions. converting arguments. (function_concept_check_p): Removed. (variable_concept_check_p): Removed. (unpack_concept_check): New. (get_concept_check_template): New. (build_call_check): Moved and renamed to build_function_check. (build_concept_check_arguments): make static. (build_function_check): Always do overload resolution in order to force conversion of template arguments (i.e., actually check that the use of a concept is valid). (build_standard_check): Renamed from build_real_concept_check. (build_real_concept_check): Build checks for C++2a concepts by (build_wildcard_concept_check): New. (build_concept_check): Use build_real_concept_check. New overload. (build_constraints): Save expressions, not normalized constraints. (build_concept_id): New. Pass tf_warning_or_error. (build_type_constraint): New. (finish_type_constraints): New. (associate_classtype_constraints): Also add constraints to union types. Note the original declaration in errors. Don't return error_mark_node in order to avoid an assertion later. (push_down_pack_expansion): Remove. (finish_shorthand_constraint): Make fold expressions, not naked parameter packs. Always apply the constraint to each template argument. (check_introduction_list): New. Fail if not enough names are introduced. (finish_template_introduction): Don't normalize constraints. Pass tsubst flags. Check for insufficient introductions. (placeholder_extract_concept_and_args): Handle the template-id case. Unpack function concept checks correctly. (tsubst_simple_requirement): Return errors if they occur. Don't process as a template. (tsubst_type_requirement): Likewise. (type_deducible_p): New. Wrap the input expression in parens for the purpose of deduction. (expression_convertible_t): New. (tsubst_compound_requirement): Use new deduction, conversion predicates. (tsubst_nested_requirement): Return errors if they occur. Don't process as a template. Instantiate and evaluate the nested requirement. (tsubst_valid_expression_requirement): New. (tsubst_simple_requirement): Use tsubst_valid_expression_requirement. (tsubst_compound_requirement): Use tsubst_valid_expression_requirement. (check_constaint_variables): New. (tsubst_constraint_variables): Check that type substitutions are valid. (tsubst_requires_expr): Likewise. Produce new requires-exprs during template substitution. Copy the previous local specialization stack, so references to non-local parameters can be found. Use cp_unevaluated. (tsubst_constraint): New. Don't evaluate concept checks. (subst_info): New. (norm_info): New. Used to build a normalization tree for concept check diagnostics. (debug_parameter_mapping): New. (debug_argument_list): New. (expand_concept): Removed. (normalize_logical_operation): Pass subst_info through call. (normalize_pack_expansion): Remove. (normalize_simple_requirement): Removed (normalize_type_requirement): Removed (normalize_compound_requirement): Removed (normalize_nested_requirement): Removed (normalize_requirement): Removed (normalize_requirements): Removed (normalize_requires_expression): Removed (normalize_variable_concept_check): Removed. (normalize_function_concept_check): Removed. (normalize_concept_check): Merged all normalize_*_check here. Substitute through written template arguments before normalizing the definition. Only substitute the innermost template arguments. (check_for_logical_overloads): Delete. (map_arguments): New. Associate template parameters with arguments. (build_parameter_mapping): New. Extract used parameters. (normalize_expression): Rewrite. (normalize_conjunction): Removed (normalize_disjunction): Removed (normalize_predicate_constraint): Removed (normalize_parameterized_constraint): Removed (normalized_map): New variable. (get_normalized_constraints): New entry point for normalization. Establishes a timer. (get_normalized_constraints_from_info): New. (get_normalized_constraints_from_decl): New. Turn on template processing prior to normalization. Handle inheriting ctors. Build the normalization arguments from the full set of template parameters of the most general template. This guarantees that we have no concrete arguments in the parameter mapping (e.g., from template members of class templates). Cache normalizations. (normalize_concept_definition): New. Cache normalizations. (normalize_template_requirements): New. (normalize_nontemplate_requirements): New. (normalize_constraint_expression): New. (tsubst_parameter_mapping): New. (get_mapped_args): New. (parameter_mapping_equivalent_p): New. Use template_args_equal. (atomic_constraints_identical_p): New. (hash_atomic_constraint): New. (satisfying_constraint_p): New. Guard against recursive evaluation of constraints during satisfaction. (satisfy_conjunction): New. (satisfy_disjunction): New. (sat_entry): New class for hashing satisfaction results. (sat_hasher): New hash traits. (sat_cache): New. (get_satisfaction): New. Returns cached satisfaction result. (save_satisfaction): New. Caches a satisfaction result. (clear_satisfaction_cache): New. (satisfaction_cache): New. Helps manage satisfaction cache requests. (decl_satisfied_cache): New. (satisfy_atom): New. (satisfy_constraint_r): New. (satisfy_constraint): Use new satisfaction algorithm. (evaluate_concept_check): New. (evaluate_concept): Removed. (evaluate_function_concept): Removed. (evaluate_variable_concept): Removed. (satisfy_constraint_expression): New. (constraint_expression_satisfied_p): New. (constraints_satisfied_p): Use strip_inheriting_ctors. Use push_/pop_access_scope. (more_constrained): Normalize before calling out to subsumption. Allow classes as arguments. (strictly_subsumes): Allow non-templates as arguments. Accept a new template argument. (weakly_subsumes): New. (at_least_as_constrained): Removed. (diagnose_other_expression): Removed. (diagnose_predicate_constraint): Removed. (diagnose_pack_expansion): Removed. (diagnose_check_constraint): Removed. (diagnose_logical_constraint): Removed. (diagnose_expression_constraint): Removed. (diagnose_type_constraint): Removed. (diagnose_implicit_conversion_constraint): Removed. (diagnose_argument_deduction_constraint): Removed. (diagnose_exception_constraint): Removed. (diagnose_parameterized_constraint): Removed. (diagnose_argument_deduction_constraint): Removed. (diagnose_argument_deduction_constraint): Removed. (diagnose_argument_deduction_constraint): Removed. (diagnose_trait_expr): New. (diagnose_requires_expr): New. (diagnose_atomic_constraint): New. (diagnose_valid_expression) Stop wrongly diagnosing valid expressions. Don't substitute as if in template decls. This causes substitution to generate expressions that aren't suitable for use with the noexcept routines. (diagnose_valid_type) Likewise. (diagnose_compound_requirement) Actually emit diagnostics for the causes of errors.Call force_paren_expr_uneval. (diagnose_declaration_constraints): Turn on template processing to suppress certain analyses. * cp-objcp-common.c (cp_common_init_ts): Make concepts typed. (cp_get_debug_type): Use hash_map_safe_*. * cp-tree.h: New function declarations for semantic actions, other facilities. Remove declaration no longer used or needed. Remove unused _CONSTR macros. (LANG_DECL_HAS_MIN): Add CONCEPT_DECL. (template_info_decl_check): Factor macro check into an inline function. (DECL_TEMPLATE_INFO): Use new check facility. (finish_concept_definition): New. Don't invalid concept declarations with invalid initializers. (find_template_parameters): New. (concept_definition_p): New. (concept_check_p): New. (variable_concept_check_p): New. (force_paren_expr_uneval): New. (ovl_iterator::using_p): A USING_DECL by itself was also introduced by a using-declaration. (struct tree_template_info): Use tree_base instead of tree_common. Add tmpl and args fields. (TI_TEMPLATE, TI_ARGS): Adjust. (DECLTYPE_FOR_INIT_CAPTURE): Remove. (CONSTR_CHECK, CONSTR_INFO, CONSTR_EXPR, CONSTR_CONTEXT): New. (ATOMIC_CONSTR_MAP, TRAIT_EXPR_LOCATION): New. (struct tree_trait_expr): Add locus field. (enum tsubst_flags): Add tf_norm as a hint to generate normalization context when diagnosing constraint failure. * cp-tree.def: Remove unused _CONSTR nodes and rename PRED_CONSTR to ATOMIC_CONSTR. (CONCEPT_DECL): New. * cxx-pretty-print.c: Remove constraint printing code. (pp_cxx_concept_definition): New. (pp_cxx_template_declaration): Print concept definitions. (pp_cxx_check_constraint): Update printing for concept definitions. (pp_cxx_nested_name_specifier): Fix a weird case where we're printing '::::' for concepts. (simple_type_specifier): Print requirements for placeholder types. (pp_cxx_constrained_type_spec): Print the associated requirements of a placeholder type. (pp_cxx_compound_requirement): Add space before the '->'. (pp_cxx_parameter_mapping): Print the parameter mapping. (pp_cxx_atomic_constraint): Use the function above. * decl.c (redeclaration_error_message): New error for concepts. (grokdeclarator): Check for and disallow decltype(auto) in parameter declarations. (grokfndecl): Don't normalize constraints. Add check for constraints on declaration. (grokvardecl): Don't normalize constraints. (grok_special_member_properties): Don't set TYPE_HAS_COMPLEX_*. (function_requirements_equivalent_p): New. Compare trailing requires clauses. Compare combined constraints in pre-C++20 mode. (decls_match): Compare trailing requires clauses. Compare template heads for function templates. Remove old constraint comparison. Simplify comparison of functions, function templates. (duplicate_function_template_decls): New. Refactor a nasty if condition into a single predicate. (require_deduced_type): Don't complain if we already complained about deduction failure. (finish_function): Perform auto deduction to ensure that constraints are checked even when functions contain no return statements. Only do auto deduction if we haven't previously seen any return statements. This prevents multiple diagnostics of the same error. (store_decomp_type): Remove. (cp_finish_decomp): Use hash_map_safe_put. * error.c: Remove constraint printing code. (dump_decl): Dump concept definitions. Handle wildcard declarations. (dump_template_decl): Likewise. (dump_type): Print associated requirements for placeholder types. (rebuild_concept_check): New. (maybe_print_single_constraint_context): New. (maybe_print_constraint_context): Recursively print nested contexts. * init.c (get_nsdmi): Use hash_map_safe_*. * lambda.c (maybe_add_lambda_conv_op): Bail if deduction failed. (add_capture): Copy parameter packs from init. (lambda_capture_field_type): Always use auto for init-capture. * logic.cc: Completely rewrite. (constraint_hash): New. (clause/ctor): Save atoms in the hash table. (replace): Save atoms during replacement. (insert): Save atoms during insertion. (contains): Only search the hash table for containment. (clause): Keep a hash of atomic constraints. (clause::clause): Explicitly copy the hash table when copying. (disjunction_p, conjunction_p, atomic_p, dnf_size, cnf_size): New. (diagnose_constraint_size): New. (subsumes_constraints_nonnull): Compare the sizes of normalized formula to determine the cheapest decomposition. * name-lookup.c (diagnose_name_conflict): Diagnose name issues with concepts. (matching_fn_p): Check constraints. (push_class_level_binding_1): Move overloaded functions case down, accept FUNCTION_DECL as target_decl. * parser.c (enum required_token): New required token for auto. (make_location): Add overload taking lexer as last parm. (cp_parser_required_error): Diagnose missing auto. (cp_parser_diagnose_ungrouped_constraint_plain): New. (cp_parser_diagnose_ungrouped_constraint_plain): New. (cp_parser_constraint_primary_expression): New. Tentatively parse the primary expression. If that fails tentatively parse a lower precedence expression in order to diagnose the error. (cp_parser_check_non_logical_constraint): New. Performs a trial parse of the right-hand-side of non-logical operators in order to generate good diagnostics. (cp_parser_constraint_logical_and_expression): New. (cp_parser_constraint_logical_or_expression): New. (cp_parser_requires_clause_expression): New. (cp_parser_requires_clause): Renamed to cp_parser_constraint_expression. (cp_parser_requires_clause_opt): Parse the requires-clause differently in -fconcepts and -std=c++2a modes. (cp_parser_requirement_list): Rename to cp_parser_requirement_seq. Rewrite so that semicolons are parsed along with requirements, not the sequence. (cp_parser_simple_requirement): Expect a semicolon at end. (cp_parser_compound_requirement): Expect a semicolon at end. Only allow trailing-return-type with -fconcepts-ts. (cp_parser_nested_requirement): Expect a semicolon at end. Parse constraint-expressions. (cp_parser_concept_definition): New. Don't fail parsing the concept definition if the initializer is ill-formed. Don't declare the concept before parsing the initializer. (cp_parser_constraint_expression): Declare earlier. (cp_parser_type_requirement): Current scope is not valid. (cp_parser_requires_expression): Commit to the tentative parse. (cp_parser_decl_specifier_seq): Warn when concept appears to be used as a decl-specifier. (cp_parser_template_declaration_after_parameters): Parse concept definitions. (cp_parser_template_id): Don't try to resolve a concept template-id yet. (cp_parser_template_id_expr): Resolve it as a concept check. (cp_parser_decl_specifier_seq): Warn on 'concept bool'. (cp_parser_type_parameter): Combine expressions not constraints. (cp_parser_explicit_template_declaration): Combine expressions not constraints. (cp_parser_maybe_concept_name): Removed. (cp_parser_simple_type_specifier): Handle an error condition of a bad constrained type specifier. Expect auto or decltype after a concept name. Also handle the case where we have a template-id as a concept check. (cp_parser_template_introduction): Diagnose errors on invalid introductions. Give up if it doesn't start with a concept name. Pedwarn if not -fconcepts-ts. (synthesize_implicit_template_parm): Don't do consistent binding. Use a new flag for constrained parameters. Combine expressions, not constraints. Fail if we get a placeholder in block scope. Placeholders that do not constrain types are not allowed in parameter declarations, so don't handle them. (cp_parser_placeholder_type_specifier): New. Implement parsing of placeholder type specifiers following a concept name or partial concept check. Disallow decltype(auto) parameters. (cp_parser_nested_name_specifier_opt): If the token is already CPP_NESTED_NAME_SPECIFIER, leave it alone. (cp_parser_id_expression, cp_parser_unqualified_id): Call cp_parser_template_id_expr. (cp_parser_placeholder_type_specifier): Add tentative parm. Don't expect a WILDCARD_DECL. (cp_parser_trait_expr): Pass trait_loc down. (cp_parser_postfix_expression): Do set location of dependent member call. * pt.c (finish_concept_definition): New. (push_template_decl_real): Handle concept definitions. (start_concept_definition): Let push_template_decl_real handle the creation of the template. (get_constraints): Return null if the table hasn't been initialized. (tsubst_copy_and_build): Build template-id expressions for concept checks. [TRAIT_EXPR]: Pass trait_loc down. (lookup_template_class_1): Add the template name to the constraint failure diagnostic. (lookup_and_finish_template_variable): Build concept checks with the correct arguments. (tsubst_function_decl): Don't substitute through constraints. Always associate constraints with functions. (template_parm_level_and_index): Make non-static. (for_each_template_parm_r): Handle requires expressions. (keep_template_parm): New. (find_template_parameters): New. (more_specialized_fn): Change how winners and losers are chosen. (make_constrained_auto): Don't normalize constraints. (template_parameters_equivalent_p): New. Compare template parameters. Add a comparison for implicitly vs. explicitly declared parameters. (template_parameter_lists_equivalent_p): New. Compare template parameter lists. (template_requirements_equivalent_p): New. (template_heads_equivalent_p): New. Compare template heads. (template_parameter_constraints_equivalent_p): New. (is_compatible_template_arg): Use weakly_subsumes. (maybe_new_partial_specialization): Use new constraint comparison for finding specializations. (process_partial_specialization): Pass main template as argument. (more_specialized_partial_spec): Don't immediately return when detecting a winner. (make_constrained_auto): Handle concept definitions. (do_auto_deduction): Update auto deduction for new concept model. Extract the function concept correctly; rename constr to check to reflect the kind of node. (tsubst): Adjust wildcard argument during substitution. [DECLTYPE_TYPE]: Remove init-capture handling. (tsubst_copy_and_build): Build concept checks, not template ids. Defer checks of function concepts. Handle concepts before variable templates. Handle calls to function concepts explicitly. (coerce_template_parms): Use concept_definition_p. Handle a deduction error where a potentially empty pack can be supplied after the last parameter of a concept. (finish_template_variable): Don't process concepts here. (instantiation_dependent_r): Use concept_check_p. (tsubst_template_args): Make non-static. (make_constrained_placeholder_type): New. Refactored from make_constrained_auto. (make_constrained_auto) Use make_constrained_placeholder_type. (make_constrained_decltype_auto) New. (tsubst_function_parms): New. (value_dependent_expression_p) [TEMPLATE_ID_EXPR]: Use concept_definition_p. (push_access_scope, pop_access_scope): No longer static. (tsubst_template_parm): Substitute TEMPLATE_PARM_CONSTRAINTS. (tsubst_friend_function): Use tsubst_constraint. Use generic_targs_for. (get_underlying_template) Use generic_targs_for. (uses_parameter_packs): Return tree. (gen_elem_of_pack_expansion_instantiation): Don't push local_specialization_stack. (prepend_one_capture): New. (tsubst_lambda_expr): Use prepend_one_capture. Don't touch local_specializations. (template_parms_level_to_args): No longer static. (add_outermost_template_args): Likewise. (find_template_parameter_info): New. Provide context for finding template parameters. (keep_template_parm): Don't keep parameters declared at depth levels greater than those of the template parameters of the source declaration. Don't propagate cv-qualified types. Return 0, so we find all template parameters, not the just first. (any_template_parm_r): New. Handle cases that are mishandled by for_each_template_parm_r. (generic_targs_for): Factor out of coerce_template_args_for_ttp. (tsubst_argument_pack): Factor out of tsubst_template_args. (constraint_sat_entry): Removed. (constraint_sat_hasher): Removed. (concept_spec_entry): Removed. (concept_spec_hasher): Removed. (constraint_memos): Removed. (concept_memos): Removed. (lookup_constraint_satisfaction): Removed. (memoize_constraint_satisfaction): Removed. (lookup_concept_satisfaction): Removed. (memoize_concept_satisfaction): Removed. (concept_expansions): Removed. (get_concept_expansion): Removed. (save_concept_expansion): Removed. (init_constraint_processing): Remove initialization of non-existing resources. (find_template_requirement): New. Search for the sub-requirement within the associated constraints. (convert_generic_types_to_packs): Also transform the associated constraint and update the current template requirements. (store_defaulted_ttp, lookup_defaulted_ttp): Remove. (add_defaults_to_ttp): Use hash_map_safe_*. * semantics.c (finish_call_expr): Diagnose calls to concepts. Handle concept checks explicitly. (finish_id_expression): Evaluate variable concepts as part of id-expression processing. Don't treat variable concepts as variables, and don't process function concepts as plain id-expressions. (force_paren_expr): Add even_uneval parm. (finish_trait_expr): Add location parm. * tree.c (special_memfn_p): New. (cp_expr_location): Handle TRAIT_EXPR. * typeck.c (check_return_expr): Actually use the diagnostic kind when performing return-type deduction. * typeck2.c (build_functional_cast): Don't rely on the location of 'auto'. 2019-10-09 Paolo Carlini * decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION. * typeck.c (cp_build_binary_op): Use the op_location_t argument in many error messages. 2019-10-08 Martin Sebor PR c++/92001 * call.c (maybe_warn_class_memaccess): Handle arrays. 2019-10-07 Paolo Carlini * call.c (resolve_args): Use cp_expr_loc_or_input_loc in one place. * decl.c (grokdeclarator): Use id_loc in one place. * decl2.c (build_anon_union_vars): Use DECL_SOURCE_LOCATION. * parser.c (cp_parser_delete_expression): Fix the location of the returned expression. (cp_parser_throw_expression): Likewise. * pt.c (determine_specialization): Use DECL_SOURCE_LOCATION. 2019-10-05 Jakub Jelinek PR c++/91369 - Implement P0784R7: constexpr new * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_UNINIT_IDENTIFIER, CPTI_HEAP_IDENTIFIER and CPTI_HEAP_DELETED_IDENTIFIER. (heap_uninit_identifier, heap_identifier, heap_deleted_identifier): Define. (type_has_constexpr_destructor, build_new_constexpr_heap_type, cxx_constant_dtor): Declare. * class.c (type_maybe_constexpr_default_constructor): Make static. (type_maybe_constexpr_destructor, type_has_constexpr_destructor): New functions. (finalize_literal_type_property): For c++2a, don't clear CLASSTYPE_LITERAL_P for types without trivial destructors unless they have non-constexpr destructors. (explain_non_literal_class): For c++2a, complain about non-constexpr destructors rather than about non-trivial destructors. * constexpr.c: Include stor-layout.h. (struct constexpr_global_ctx): New type. (struct constexpr_ctx): Add global field, remove values and constexpr_ops_count. (cxx_replaceable_global_alloc_fn): New inline function. (cxx_eval_call_expression): For c++2a allow calls to replaceable global allocation functions, for new return address of a heap uninit var, for delete record its deletion. Change ctx->values->{get,put} to ctx->global->values.{get,put}. (non_const_var_error): Add auto_diagnostic_group sentinel. Emit special diagnostics for heap variables. (cxx_eval_store_expression): Change ctx->values->{get,put} to ctx->global->values.{get,put}. (cxx_eval_loop_expr): Initialize jump_target if NULL. Change new_ctx.values->remove to ctx->global->values.remove. (cxx_eval_constant_expression): Change *ctx->constexpr_ops_count to ctx->global->constexpr_ops_count. Change ctx->values->{get,put} to ctx->global->values.{get,put}. : Formatting fix. On cast of replaceable global allocation function to some pointer type, adjust the type of the heap variable and change name from heap_uninit_identifier to heap_identifier. (find_heap_var_refs): New function. (cxx_eval_outermost_constant_expr): Add constexpr_dtor argument, handle evaluation of constexpr dtors and add tracking of heap variables. Use tf_no_cleanup for get_target_expr_with_sfinae. (cxx_constant_value): Adjust cxx_eval_outermost_constant_expr caller. (cxx_constant_dtor): New function. (maybe_constant_value, fold_non_dependent_expr_template, maybe_constant_init_1): Adjust cxx_eval_outermost_constant_expr callers. (potential_constant_expression_1): Ignore clobbers. Allow COND_EXPR_IS_VEC_DELETE for c++2a. * decl.c (initialize_predefined_identifiers): Add heap identifiers. (decl_maybe_constant_destruction): New function. (cp_finish_decl): Don't clear TREE_READONLY for constexpr variables with non-trivial, but constexpr destructors. (register_dtor_fn): For constexpr variables with constexpr non-trivial destructors call cxx_maybe_build_cleanup instead of adding destructor calls at runtime. (expand_static_init): For constexpr variables with constexpr non-trivial destructors call cxx_maybe_build_cleanup. (grokdeclarator): Allow constexpr destructors for c++2a. Formatting fix. (cxx_maybe_build_cleanup): For constexpr variables with constexpr non-trivial destructors call cxx_constant_dtor instead of adding destructor calls at runtime. * init.c: Include stor-layout.h. (build_new_constexpr_heap_type, maybe_wrap_new_for_constexpr): New functions. (build_new_1): For c++2a and new[], add cast around the alloc call to help constexpr evaluation figure out the type of the heap storage. (build_vec_delete_1): Set DECL_INITIAL of tbase and emit a DECL_EXPR for it instead of initializing an uninitialized variable. * method.c: Include intl.h. (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P, SFK_MOVE_P): Move definitions earlier. (process_subob_fn): Add sfk argument, adjust non-constexpr call diagnostics based on it. (walk_field_subobs): Formatting fixes. Adjust process_subob_fn caller. (synthesized_method_base_walk): Likewise. (synthesized_method_walk): Set *constexpr_p to true for dtors in c++2a. Fix up DR number in comment. (implicitly_declare_fn): Formatting fix. * typeck2.c (store_init_value): Don't call cp_fully_fold_init on initializers of automatic non-constexpr variables in constexpr functions. 2019-10-04 Jakub Jelinek PR c++/71504 * constexpr.c (cxx_fold_indirect_ref_1): New function. (cxx_fold_indirect_ref): Use it. PR c++/91974 * cp-gimplify.c (cp_gimplify_expr) : For -fstrong-eval-order ensure CALL_EXPR_FN side-effects are evaluated before any arguments. Additionally, ensure CALL_EXPR_FN that isn't invariant nor OBJ_TYPE_REF nor SSA_NAME is forced into a temporary. 2019-10-03 Paolo Carlini * init.c (build_new): Use cp_expr_loc_or_input_loc in two places. * name-lookup.c (do_pushdecl): Use DECL_SOURCE_LOCATION. (push_class_level_binding_1): Likewise. (set_decl_namespace): Likewise. 2019-10-03 Jakub Jelinek * constexpr.c (cxx_eval_constant_expression) : If not skipping upon entry to body, run cleanup with the same *jump_target as it started to run the cleanup even if the body returns, breaks or continues. (potential_constant_expression_1): Allow CLEANUP_STMT. * constexpr.c (cxx_eval_store_expression): Formatting fix. Handle const_object_being_modified with array type. 2019-10-02 Jason Merrill * typeck2.c (store_init_value): Only clear_cv_and_fold_caches if the value is constant. 2019-09-30 Jason Merrill Use hash_map_safe_* functions. * constexpr.c (maybe_initialize_fundef_copies_table): Remove. (get_fundef_copy): Use hash_map_safe_get_or_insert. * cp-objcp-common.c (cp_get_debug_type): Use hash_map_safe_*. * decl.c (store_decomp_type): Remove. (cp_finish_decomp): Use hash_map_safe_put. * init.c (get_nsdmi): Use hash_map_safe_*. * pt.c (store_defaulted_ttp, lookup_defaulted_ttp): Remove. (add_defaults_to_ttp): Use hash_map_safe_*. 2019-10-02 Richard Biener PR c++/91606 * decl.c (build_ptrmemfunc_type): Mark pointer-to-member fat pointer structure members as DECL_NONADDRESSABLE_P. 2019-09-28 Marek Polacek PR c++/91889 - follow-up fix for DR 2352. * call.c (involves_qualification_conversion_p): New function. (direct_reference_binding): Build a ck_qual if the conversion would involve a qualification conversion. (convert_like_real): Strip the conversion created by the ck_qual in direct_reference_binding. PR c++/91921 - stray warning with -Woverloaded-virtual. * class.c (warn_hidden): Only emit the second part of -Woverloaded-virtual if the first part was issued. Use inform instead warning_at. PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17. * pt.c (invalid_nontype_parm_type_p): Only emit errors when tf_error. 2019-09-27 Jakub Jelinek PR c++/88203 * parser.c (cp_parser_omp_var_list_no_open): Parse predefined variables. * semantics.c (finish_omp_clauses): Allow predefined variables in shared and firstprivate clauses, even when they are predetermined shared. * cp-gimplify.c (cxx_omp_predetermined_sharing_1): Return OMP_CLAUSE_DEFAULT_SHARED for predefined variables. 2019-09-27 Jason Merrill * constexpr.c (cxx_fold_indirect_ref): Use similar_type_p. (cxx_eval_indirect_ref): Likewise. Improve error location. * cp-tree.h (class iloc_sentinel): New. * decl.c (grokdeclarator, finish_enum_value_list): Use it. * mangle.c (mangle_decl_string): Use it. * pt.c (perform_typedefs_access_check): Use it. 2019-09-27 Richard Sandiford * cp-tree.h (build_cxx_call): Take the original function decl as an optional final parameter. (cp_build_function_call_vec): Likewise. * call.c (build_cxx_call): Likewise. Pass all built-in calls to check_builtin_function_arguments. * typeck.c (build_function_call_vec): Take the original function decl as an optional final parameter and pass it to cp_build_function_call_vec. (cp_build_function_call_vec): Take the original function decl as an optional final parameter and pass it to build_cxx_call. 2019-09-25 Marek Polacek PR c++/91877 - ICE with converting member of packed struct. * call.c (convert_like_real): Use similar_type_p in an assert. 2019-09-25 Paolo Carlini * name-lookup.c (check_extern_c_conflict): Use DECL_SOURCE_LOCATION. (check_local_shadow): Use it in three additional places. 2019-09-24 Jason Merrill * parser.c (cp_parser_postfix_expression): Do set location of dependent member call. 2019-09-24 Marek Polacek PR c++/91868 - improve -Wshadow location. * name-lookup.c (check_local_shadow): Use DECL_SOURCE_LOCATION instead of input_location. PR c++/91845 - ICE with invalid pointer-to-member. * expr.c (mark_use): Use error_operand_p. * typeck2.c (build_m_component_ref): Check error_operand_p after calling mark_[lr]value_use. 2019-09-23 Paolo Carlini * pt.c (check_explicit_specialization): Use cp_expr_loc_or_input_loc. (process_partial_specialization): Likewise. (convert_nontype_argument_function): Likewise. (invalid_tparm_referent_p): Likewise. (convert_template_argument): Likewise. (check_valid_ptrmem_cst_expr): Tidy. 2019-09-23 Jason Merrill PR c++/91809 - bit-field and ellipsis. * call.c (convert_arg_to_ellipsis): Don't call decay_conversion for arithmetic arguments. 2019-09-23 Marek Polacek PR c++/91844 - Implement CWG 2352, Similar types and reference binding. * call.c (reference_related_p): Use similar_type_p instead of same_type_p. (reference_compatible_p): Update implementation to match CWG 2352. * cp-tree.h (similar_type_p): Declare. * typeck.c (similar_type_p): New. 2019-09-22 Marek Polacek PR c++/91819 - ICE with operator++ and enum. * call.c (build_new_op_1): Set arg2_type. 2019-09-17 Jason Merrill * parser.c (cp_parser_statement): Handle [[likely]] on compound-statement. 2019-09-19 Jason Merrill Revert: * call.c (build_new_op_1): Don't apply any standard conversions to the operands of a built-in operator. Don't suppress conversions in cp_build_unary_op. * typeck.c (cp_build_unary_op): Do integral promotions for enums. 2019-09-16 Paolo Carlini * decl.c (grokdeclarator): Use declspecs->locations and declarator->id_loc in a few error messages. * pt.c (finish_member_template_decl): Use DECL_SOURCE_LOCATION. (push_template_decl_real): Likewise. 2019-09-15 Jason Merrill PR c++/30277 - int-width bit-field promotion. PR c++/33819 - long bit-field promotion. * typeck.c (cp_perform_integral_promotions): Handle large bit-fields properly. Handle 32-bit non-int bit-fields properly. (is_bitfield_expr_with_lowered_type): Don't look through NOP_EXPR. PR c++/82165 - enum bitfields and operator overloading. * call.c (build_new_op_1): Use unlowered_expr_type. * call.c (build_new_op_1): Don't apply any standard conversions to the operands of a built-in operator. Don't suppress conversions in cp_build_unary_op. * typeck.c (cp_build_unary_op): Do integral promotions for enums. 2019-09-15 Marek Polacek PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF. * pt.c (build_non_dependent_expr): Call build_non_dependent_expr for the first operand. 2019-09-15 Nathan Sidwell * cp-tree.h (DECL_CLONED_FUNCTION_P): Reimplement using IDENTIFIER_CDTOR_P, correct documentation. (DECL_CLONED_FUNCTION): Directly access field. (decl_cloned_function_p): Delete. * class.c (decl_cloned_function_p): Delete. * pt.c (instantiate_template_1): Check DECL_CHAIN is a decl. 2019-09-11 Nathan Sidwell * c-objcp-common.c (cp-objcp-common.c): Alphababetize and correctly mark all C++ nodes. * decl.c (cp_tree_node_structure): Alphabetize. 2019-09-10 Marek Polacek PR c++/91673 - ICE with noexcept in alias-declaration. * parser.c (CP_PARSER_FLAGS_DELAY_NOEXCEPT): New parser flag. (cp_parser_lambda_declarator_opt): Pass CP_PARSER_FLAGS_NONE to cp_parser_exception_specification_opt. (cp_parser_direct_declarator): Adjust a call to cp_parser_exception_specification_opt. (cp_parser_member_declaration): Pass CP_PARSER_FLAGS_DELAY_NOEXCEPT to cp_parser_declarator if not processing a friend or typedef declaration. (cp_parser_late_noexcept_specifier): Adjust a call to cp_parser_noexcept_specification_opt. (cp_parser_noexcept_specification_opt): New parameter for parser flags, drop the FRIEND_P parameter. Use the new parameter. (cp_parser_exception_specification_opt): Likewise. (cp_parser_transaction): Adjust a call to cp_parser_noexcept_specification_opt. (cp_parser_transaction_expression): Likewise. 2019-09-10 Marek Polacek PR c++/91705 - constexpr evaluation rejects ++/-- on floats. * constexpr.c (cxx_eval_increment_expression): Call fold_simple on the offset. 2019-09-10 Paolo Carlini * decl.c (has_designator_problem): Use cp_expr_loc_or_input_loc in error_at. (build_enumerator): Likewise. (cp_finish_decl): Use DECL_SOURCE_LOCATION. (grokdeclarator): Use id_loc in two error_at; change errror message about constinit together constexpr to use two ranges. 2019-09-09 Marek Polacek PR c++/84374 - diagnose invalid uses of decltype(auto). * decl.c (grokdeclarator): Diagnose wrong usage of decltype(auto) in a function declaration. 2019-09-06 Nathan Sidwell PR c++/91125 * cp-tree.h (IDENTIFIER_REPO_CHOSEN, DECL_REPO_AVAILABLE_P): Delete. (struct lang_decl_base): Remove repo_available_p. * decl.c (duplicate_decls): Don't copy DECL_REPO_AVAILABLE_P. (Reserve TREE_LANG_FLAG_3 for modules. * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete. (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6. * class.c (build_ctor_vtbl_group): Don't set DECL_CONSTRUCTION_VTABLE_P. * decl2.c (determine_visibility_from_class): Don't check DECL_CONSTRUCTION_VTABLE_P anymore. 2019-09-06 Martin Liska PR c++/91125 * Make-lang.in: Remove repo.o. * config-lang.in: Likewise. * cp-tree.h (init_repo): Remove declarations of repo-related functions. (repo_emit_p): Likewise. (repo_export_class_p): Likewise. (finish_repo): Likewise. * decl2.c (import_export_class): Always set -1 value/ (mark_needed): Remove -frepo from comment. (import_export_decl): Similarly here. (c_parse_final_cleanups): Remove call of finish_repo. * lex.c (cxx_init): Remove call to init_repo. * optimize.c (can_alias_cdtor): Remove dead condition. * pt.c (push_template_decl_real): Update comment. (instantiate_decl): Remove dead code used for -frepo. * repo.c: Remove. 2019-09-05 Marek Polacek PR c++/91644 - ICE with constinit in function template. * decl.c (start_decl): Call retrofit_lang_decl for constinit variables. * pt.c (tsubst_expr): Pass LOOKUP_CONSTINIT down to cp_finish_decl for constinit variables. 2019-09-05 Nathan Sidwell * cp-tree.h (DECL_VTABLE_OR_VTT_P): Forward to DECL_VIRTUAL_P. 2019-09-04 Marek Polacek * call.c (build_over_call): Remove -fdeduce-init-list implementation. * pt.c (unify): Likewise. 2019-09-01 Marek Polacek PR c++/91129 - wrong error with binary op in template argument. * typeck.c (warn_for_null_address): Use fold_for_warn instead of fold_non_dependent_expr. (cp_build_binary_op): Likewise. 2019-08-30 Jason Merrill Add source location to TRAIT_EXPR. * cp-tree.h (TRAIT_EXPR_LOCATION): New. (struct tree_trait_expr): Add locus field. * parser.c (cp_parser_trait_expr): Pass trait_loc down. * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Likewise. * semantics.c (finish_trait_expr): Add location parm. * tree.c (cp_expr_location): Handle TRAIT_EXPR. 2019-08-29 Paolo Carlini * decl.c (check_var_type): Add location_t parameter and use it. (grokdeclarator): Adjust call. * pt.c (tsubst_decl): Likewise. * cp-tree.h: Adjust declaration. 2019-08-28 Marek Polacek Implement P1152R4: Deprecating some uses of volatile. PR c++/91361 * cp-gimplify.c (cp_fold): Set TREE_THIS_VOLATILE. * decl.c (grokdeclarator): Warn about a volatile-qualified structured binding and return type. (grokparms): Warn about a volatile-qualified function parameter. * expr.c (mark_use) : Emit a -Wvolatile warning. * typeck.c (cp_build_unary_op): Emit a -Wvolatile warning for pre and post ++/-- on a volatile operand. (genericize_compound_lvalue): Use a better location. Don't lose TREE_THIS_VOLATILE. (cp_build_modify_expr): Emit a -Wvolatile warning for a compound assignment whose LHS is volatile-qualified. Build the assignment with a more precise location. 2019-08-28 Marek Polacek PR c++/91360 - Implement C++20 P1143R2: constinit. * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Define. (LOOKUP_CONSTINIT): Define. (enum cp_decl_spec): Add ds_constinit. * decl.c (check_tag_decl): Give an error for constinit in type declarations. (check_initializer): Also check LOOKUP_CONSTINIT. (cp_finish_decl): Add checking for a constinit declaration. Set TINFO_VAR_DECLARED_CONSTINIT. (grokdeclarator): Add checking for a declaration with the constinit specifier. * lex.c (init_reswords): Handle D_CXX20. * parser.c (cp_lexer_get_preprocessor_token): Pass a better location to warning_at. Warn about C++20 keywords. (cp_keyword_starts_decl_specifier_p): Handle RID_CONSTINIT. (cp_parser_diagnose_invalid_type_name): Add an inform about constinit. (cp_parser_decomposition_declaration): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl. (cp_parser_decl_specifier_seq): Handle RID_CONSTINIT. (cp_parser_init_declarator): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl. (set_and_check_decl_spec_loc): Add "constinit". * pt.c (tsubst_decl): Set TINFO_VAR_DECLARED_CONSTINIT. (instantiate_decl): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl. * typeck2.c (store_init_value): If a constinit variable wasn't initialized using a constant initializer, give an error. 2019-08-28 Nathan Sidwell PR c++/90613 * name-lookup.c (cp_emit_debug_info): Check for builtins during overload iteration. 2019-08-27 Marek Polacek PR c++/81676 - bogus -Wunused warnings in constexpr if. * semantics.c (maybe_mark_exp_read_r): New function. (finish_if_stmt): Call it on THEN_CLAUSE and ELSE_CLAUSE. PR c++/91428 - warn about std::is_constant_evaluated in if constexpr. * cp-tree.h (decl_in_std_namespace_p): Declare. * semantics.c (is_std_constant_evaluated_p): New. (finish_if_stmt_cond): Warn about "std::is_constant_evaluated ()" in an if-constexpr. * typeck.c (decl_in_std_namespace_p): No longer static. 2019-08-26 Jason Merrill * decl.c (duplicate_decls): Always merge DECL_DECLARED_CONSTEXPR_P. 2019-08-26 Marek Polacek PR c++/91545 - ICE in constexpr store evaluation. * constexpr.c (cxx_eval_store_expression): Check FIELD_DECL instead of DECL_P. 2019-08-24 Nathan Sidwell * class.c (check_for_overrides): Conversion operators need checking too. 2019-08-24 Paolo Carlini * semantics.c (finish_switch_cond): Improve error message location. 2019-08-23 Jason Merrill * decl2.c (decl_dependent_p): New. (mark_used): Check it instead of just processing_template_decl. 2019-08-23 Jason Merrill * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant error. 2019-08-23 Marek Polacek PR c++/91521 - wrong error with operator->. * decl.c (grokdeclarator): Return error_mark_node for an invalid trailing return type. PR c++/79817 - attribute deprecated on namespace. * cp-tree.h (cp_warn_deprecated_use_scopes): Declare. * decl.c (grokdeclarator): Call cp_warn_deprecated_use_scopes. (type_is_deprecated): Likewise. * decl2.c (cp_warn_deprecated_use_scopes): New function. * name-lookup.c (handle_namespace_attrs): Handle attribute deprecated. * parser.c (cp_parser_namespace_alias_definition): Call cp_warn_deprecated_use_scopes. (cp_parser_using_declaration): Likewise. (cp_parser_using_directive): Likewise. * semantics.c (finish_id_expression_1): Likewise. 2019-08-23 Nathan Sidwell * class.c (check_for_override): Checking IDENTIFIER_VIRTUAL_P is sufficient, reorder DECL_OVERRIDE_P check. 2019-08-23 Iain Sandoe PR pch/61250 * parser.c (cp_parser_initial_pragma): Call c_common_no_more_pch () after determining that the first token is not PRAGMA_GCC_PCH_PREPROCESS. 2019-08-22 Marek Polacek PR c++/91304 - prefix attributes ignored in condition. * parser.c (cp_parser_condition): Handle prefix attributes. 2019-08-21 Richard Sandiford PR c++/91505 * decl.c (duplicate_decls): Call copy_attributes_to_builtin inside the BUILT_IN_NORMAL block rather than afterward. 2019-08-19 Marek Polacek PR c++/91264 - detect modifying const objects in constexpr. * constexpr.c (modifying_const_object_error): New function. (cxx_eval_call_expression): Set TREE_READONLY on a CONSTRUCTOR of a const-qualified object after it's been fully constructed. (modifying_const_object_p): New function. (cxx_eval_store_expression): Detect modifying a const object during constant expression evaluation. (cxx_eval_increment_expression): Use a better location when building up the store. (cxx_eval_constant_expression) : Mark a constant object's constructor TREE_READONLY. 2019-08-15 Jason Merrill PR c++/90393 - ICE with thow in ?: PR c++/64372, DR 1560 - Gratuitous lvalue-to-rvalue conversion in ?: * tree.c (lvalue_kind): Handle throw in one arm. * typeck.c (rationalize_conditional_expr): Likewise. (cp_build_modify_expr): Likewise. 2019-08-14 Jason Merrill Implement P0848R3, Conditionally Trivial Special Member Functions. * tree.c (special_memfn_p): New. * class.c (add_method): When overloading, hide ineligible special member fns. (check_methods): Set TYPE_HAS_COMPLEX_* here. * decl.c (grok_special_member_properties): Not here. * name-lookup.c (push_class_level_binding_1): Move overloaded functions case down, accept FUNCTION_DECL as target_decl. 2019-08-14 Jonathan Wakely PR c++/91436 * name-lookup.c (get_std_name_hint): Fix min_dialect field for complex_literals and make_unique entries. 2019-08-14 Jakub Jelinek Marek Polacek PR c++/91391 - bogus -Wcomma-subscript warning. * parser.c (cp_parser_postfix_open_square_expression): Don't warn about a deprecated comma here. Pass warn_comma_subscript down to cp_parser_expression. (cp_parser_expression): New bool parameter. Warn about uses of a comma operator within a subscripting expression. (cp_parser_skip_to_closing_square_bracket): Revert to pre-r274121 state. (cp_parser_skip_to_closing_square_bracket_1): Remove. 2019-08-14 Jonathan Wakely * name-lookup.c (get_std_name_hint): Add more entries. 2019-08-14 Paolo Carlini * decl2.c (grok_array_decl): Use the location of the open square bracket in error message about invalid types. 2019-08-14 Paolo Carlini * decl.c (grokdeclarator): Check here for typedef a function definition or a member function definition. (start_function): Adjust. (grokmethod): Likewise. 2019-08-13 Richard Sandiford PR middle-end/91421 * decl.c (duplicate_decls): Use copy_decl_built_in_function. * pt.c (declare_integer_pack): Use set_decl_built_in_function. 2019-08-13 Marek Polacek PR c++/90473 - wrong code with nullptr in default argument. * call.c (null_ptr_cst_p): Update quote from the standard. * decl.c (check_default_argument): Don't return nullptr when the arg has side-effects. 2019-08-13 Marek Polacek * cp-tree.h (DECL_MUTABLE_P): Use FIELD_DECL_CHECK. 2019-08-10 Jakub Jelinek * parser.c (cp_parser_omp_clause_name): Parse device_type. (cp_parser_omp_clause_device_type): New function. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DEVICE_TYPE. (OMP_DECLARE_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DEVICE_TYPE. (cp_parser_omp_declare_target): Handle device_type clauses. Remove diagnostics for declare target with clauses nested in clause-less declare target declaration-definition-seq. * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DEVICE_TYPE. 2019-08-09 Jakub Jelinek * parser.c (check_no_duplicate_clause): Simplify using omp_find_clause. (cp_parser_omp_clause_if): Fix up printing of target {enter,exit} data directive name modifiers. PR c/91401 * parser.c (cp_parser_omp_clause_dist_schedule): Comment out the check_no_duplicate_clause call, instead emit a warning for duplicate dist_schedule clauses. 2019-08-08 Paolo Carlini * decl.c (grokdeclarator): Use id_loc and EXPR_LOCATION in a few error messages. 2019-08-08 Marek Polacek PR c++/87519 - bogus warning with -Wsign-conversion. * typeck.c (cp_build_binary_op): Use same_type_p instead of comparing the types directly. * constexpr.c (inline_asm_in_constexpr_error): New. (cxx_eval_constant_expression) : Call it. (potential_constant_expression_1) : Likewise. 2019-08-08 Jakub Jelinek * semantics.c (finish_omp_clauses): For C_ORT_OMP OMP_CLAUSE_USE_DEVICE_* clauses use oacc_reduction_head bitmap instead of generic_head to track duplicates. 2019-08-07 Marek Polacek PR c++/81429 - wrong parsing of constructor with C++11 attribute. * parser.c (cp_parser_constructor_declarator_p): Handle the scenario when a parameter declaration begins with [[attribute]]. 2019-08-07 Marek Polacek PR c++/91346 - Implement P1668R1, allow unevaluated asm in constexpr. * constexpr.c (cxx_eval_constant_expression): Handle ASM_EXPR. (potential_constant_expression_1) : Allow. * cp-tree.h (finish_asm_stmt): Adjust. * parser.c (cp_parser_asm_definition): Grab the locaion of "asm" and use it. Change an error to a pedwarn. Allow asm in C++2a, warn otherwise. * pt.c (tsubst_expr): Pass a location down to finish_asm_stmt. * semantics.c (finish_asm_stmt): New location_t parameter. Use it. 2019-08-07 Jakub Jelinek * parser.c (cp_parser_omp_clause_name): Parse use_device_addr clause. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR. (OMP_TARGET_DATA_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR. (cp_parser_omp_target_data): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR like PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR, adjust diagnostics about no map or use_device_* clauses. * semantics.c (finish_omp_clauses): For OMP_CLAUSE_USE_DEVICE_PTR in OpenMP, require pointer or reference to pointer type rather than pointer or array or reference to pointer or array type. Handle OMP_CLAUSE_USE_DEVICE_ADDR. * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_USE_DEVICE_ADDR. 2019-08-06 Jason Merrill PR c++/91378 - ICE with noexcept and auto return type. * pt.c (maybe_instantiate_noexcept): push_to_top_level. 2019-08-06 Paolo Carlini * decl.c (check_array_designated_initializer): Use cp_expr_loc_or_input_loc in one place. 2019-08-06 Jakub Jelinek * parser.c (cp_parser_omp_for_loop): For OMP_LOOP, ignore parallel clauses and predetermine iterator as lastprivate. * semantics.c (handle_omp_for_class_iterator): Use OMP_CLAUSE_LASTPRIVATE_LOOP_IV instead of OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, set it for lastprivate also on OMP_LOOP construct. If a clause is missing for class iterator on OMP_LOOP, add firstprivate clause, and if there is private clause, turn it into firstprivate too. (finish_omp_for): Formatting fix. For OMP_LOOP, adjust OMP_CLAUSE_LASTPRIVATE_LOOP_IV clause CP_CLAUSE_INFO, so that it uses copy ctor instead of default ctor. * cp-gimplify.c (cp_gimplify_expr): Handle OMP_LOOP like OMP_DISTRIBUTE etc. (cp_fold_r): Likewise. (cp_genericize_r): Likewise. (cxx_omp_finish_clause): Also finish lastprivate clause with OMP_CLAUSE_LASTPRIVATE_LOOP_IV flag. * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_BIND. (tsubst_omp_for_iterator): For OMP_LOOP, ignore parallel clauses and predetermine iterator as lastprivate. * constexpr.c (potential_constant_expression_1): Handle OMP_LOOP like OMP_DISTRIBUTE etc. 2019-08-05 Marek Polacek DR 2413 - typename in conversion-function-ids. * parser.c (cp_parser_conversion_type_id): Call cp_parser_type_specifier_seq with CP_PARSER_FLAGS_TYPENAME_OPTIONAL instead of CP_PARSER_FLAGS_NONE. 2019-08-05 Paolo Carlini * cp-tree.h (cp_expr_loc_or_input_loc): New. (cxx_incomplete_type_diagnostic): Use it. * call.c (build_converted_constant_expr_internal, convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing, build_over_call, build_cxx_call, perform_implicit_conversion_flags, initialize_reference): Likewise. * constexpr.c (cxx_eval_internal_function, cxx_eval_call_expression, eval_and_check_array_index, cxx_eval_store_expression, cxx_eval_statement_list, cxx_eval_loop_expr, cxx_eval_constant_expression, potential_constant_expression_1): Likewise. * constraint.cc (check_for_logical_overloads, satisfy_predicate_constraint): Likewise. * cp-gimplify.c (cp_gimplify_expr): Likewise. * cvt.c (cp_convert_to_pointer, convert_to_reference, cp_convert_and_check, ocp_convert, maybe_warn_nodiscard): Likewise. * decl.c (pop_switch): Likewise. * decl2.c (delete_sanity): Likewise. * error.c (location_of): Likewise. * init.c (maybe_warn_list_ctor, build_aggr_init, warn_placement_new_too_small, build_new_1, build_vec_init): Likewise. * lex.c (unqualified_name_lookup_error): Likewise. * parser.c (cp_parser_initializer_list, cp_parser_omp_for_cond): Likewise. * pt.c (check_for_bare_parameter_packs, check_valid_ptrmem_cst_expr, unify_arg_conversion, convert_nontype_argument, tsubst_copy_and_build, resolve_typename_type): Likewise. * semantics.c (maybe_convert_cond, finish_call_expr, cp_build_vec_convert): Likewise. * typeck.c (decay_conversion, rationalize_conditional_expr, cp_build_unary_op, build_x_compound_expr_from_list, maybe_warn_about_returning_address_of_local, maybe_warn_pessimizing_move): Likewise. * typeck2.c (check_narrowing, digest_init_r, process_init_constructor_array): Likewise. 2019-08-05 Tom Honermann * parser.c (cp_parser_template_declaration_after_parameters): Enable class template argument deduction for non-type template parameters in literal operator templates. 2019-08-05 Marek Polacek PR c++/91338 - Implement P1161R3: Deprecate a[b,c]. * parser.c (cp_parser_postfix_open_square_expression): Warn about uses of a comma operator within a subscripting expression. (cp_parser_skip_to_closing_square_bracket_1): New function, made out of... (cp_parser_skip_to_closing_square_bracket): ...this. 2019-08-05 Jason Merrill * semantics.c (force_paren_expr): Preserve location. 2019-08-02 Marek Polacek PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda. * pt.c (value_dependent_expression_p): Consider __PRETTY_FUNCTION__ inside a template function value-dependent. 2019-08-02 Paolo Carlini * tree.c (handle_nodiscard_attribute): Do not warn about nodiscard applied to a constructor. 2019-08-02 Martin Liska * decl.c (grok_op_properties): Mark DECL_SET_IS_OPERATOR_DELETE for user-provided delete operators. 2019-08-01 Martin Sebor PR c++/90947 * decl.c (reshape_init_array_1): Avoid truncating initializer lists containing string literals. 2019-08-01 Marek Polacek PR c++/90805 - detect narrowing in case values. * decl.c (case_conversion): Detect narrowing in case values. 2019-07-31 Paolo Carlini * decl2.c (delete_sanity): Improve diagnostic locations, use cp_expr_loc_or_loc in four places. 2019-07-31 Jason Merrill PR c++/90538 - multiple expansions of capture packs * cp-tree.h (DECLTYPE_FOR_INIT_CAPTURE): Remove. * lambda.c (add_capture): Copy parameter packs from init. (lambda_capture_field_type): Always use auto for init-capture. * pt.c (uses_parameter_packs): Return tree. (tsubst) [DECLTYPE_TYPE]: Remove init-capture handling. (gen_elem_of_pack_expansion_instantiation): Don't push local_specialization_stack. (prepend_one_capture): New. (tsubst_lambda_expr): Use it. Don't touch local_specializations. (do_auto_deduction): Avoid redundant error. Fix copy_node of TEMPLATE_INFO. * cp-tree.h (struct tree_template_info): Use tree_base instead of tree_common. Add tmpl and args fields. (TI_TEMPLATE, TI_ARGS): Adjust. 2019-07-30 Martin Liska PR tree-optimization/91270 * tree-ssa-dce.c (propagate_necessity): Mark 2nd argument of delete operator as needed. 2019-07-25 Martin Liska Dominik Infuhr PR c++/23383 * decl.c (cxx_init_decl_processing): Mark delete operators with DECL_SET_IS_OPERATOR_DELETE. 2019-07-25 Martin Liska * decl.c (duplicate_decls): Use new macros (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P). (cxx_init_decl_processing): Likewise. (grok_op_properties): Likewise. * parser.c (cp_parser_lambda_declarator_opt): Likewise. 2019-07-24 Martin Sebor PR driver/80545 * decl.c (finish_function): Use lang_mask. 2019-07-20 Jason Merrill * cp-tree.h (ovl_iterator::using_p): A USING_DECL by itself was also introduced by a using-declaration. 2019-07-20 Jason Merrill Reduce memory consumption for push/pop_access_scope. * name-lookup.c (leave_scope): Do add class levels other than previous_class_level to free_binding_level. (invalidate_class_lookup_cache): Move from class.c, add to free_binding_level. * pt.c (saved_access_scope): Change from list to vec. 2019-07-20 Jakub Jelinek * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOPING_CHECK instead of OMP_LOOP_CHECK. * parser.c (cp_parser_omp_clause_name): Handle bind clause. (cp_parser_omp_clause_bind): New function. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_BIND. (OMP_LOOP_CLAUSE_MASK): Define. (cp_parser_omp_loop): New function. (cp_parser_omp_parallel, cp_parser_omp_teams): Handle parsing of loop combined with parallel or teams. (cp_parser_omp_construct): Handle PRAGMA_OMP_LOOP. (cp_parser_pragma): Likewise. * pt.c (tsubst_expr): Handle OMP_LOOP. * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_BIND. 2019-07-19 Jason Merrill PR c++/90101 - dependent class non-type parameter. * pt.c (invalid_nontype_parm_type_p): Check for dependent class type. 2019-07-18 Jason Merrill PR c++/90098 - partial specialization and class non-type parms. PR c++/90099 PR c++/90101 * call.c (build_converted_constant_expr_internal): Don't copy. * pt.c (process_partial_specialization): Allow VIEW_CONVERT_EXPR around class non-type parameter. (unify) [TEMPLATE_PARM_INDEX]: Ignore cv-quals. 2019-07-16 Jason Merrill * parser.c (make_location): Add overload taking cp_lexer* as last parameter. * parser.c (cp_parser_simple_type_specifier): Separate tentative parses for optional type-spec and CTAD. * parser.c (cp_parser_nested_name_specifier_opt): If the token is already CPP_NESTED_NAME_SPECIFIER, leave it alone. 2019-07-12 Jakub Jelinek * parser.c (cp_parser_omp_clause_name): Handle order clause. (cp_parser_omp_clause_order): New function. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER. (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_ORDER. * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER. * pt.c (tsubst_omp_clauses): Likewise. 2019-07-10 Paolo Carlini * decl.c (get_type_quals, smallest_type_location (const cp_decl_specifier_seq*)): New. (check_tag_decl): Use smallest_type_location in error_at about multiple types in one declaration. (grokdeclarator): Use locations[ds_complex] in error_at about complex invalid; use locations[ds_storage_class] in error_at about static cdtor; use id_loc in error_at about flexible array member in union; use get_type_quals. 2019-07-09 Martin Sebor PR c++/61339 * cp-tree.h: Change class-key of PODs to struct and others to class. * search.c: Same. * semantics.c (finalize_nrv_r): Same. 2019-07-09 Martin Sebor PR c++/61339 * constexpr.c (cxx_eval_call_expression): Change class-key from class to struct and vice versa to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. * constraint.cc (get_concept_definition): Same. * cp-tree.h: Same. * cxx-pretty-print.h: Same. * error.c: Same. * logic.cc (term_list::replace): Same. * name-lookup.c (find_local_binding): Same. * pt.c (tsubst_binary_right_fold): Same. * search.c (field_accessor_p): Same. * semantics.c (expand_or_defer_fn): Same. 2019-07-08 Jakub Jelinek PR c++/91110 * decl2.c (cp_omp_mappable_type_1): Don't emit any note for error_mark_node type. 2019-07-05 Jakub Jelinek PR c++/67184 PR c++/69445 * call.c (build_new_method_call_1): Remove set but not used variable binfo. 2019-07-05 Paolo Carlini PR c++/67184 (again) PR c++/69445 * call.c (build_over_call): Devirtualize user-defined operators coming from a base too. (build_new_method_call_1): Do not devirtualize here. 2019-07-04 Marek Polacek DR 1813 PR c++/83374 - __is_standard_layout wrong for a class with repeated bases. * class.c (check_bases): Set CLASSTYPE_NON_STD_LAYOUT for a class if CLASSTYPE_REPEATED_BASE_P is true. 2019-07-04 Andrew Stubbs * cp-tree.h (cp_omp_emit_unmappable_type_notes): New prototype. * decl.c (cp_finish_decl): Call cp_omp_emit_unmappable_type_notes. * decl2.c (cp_omp_mappable_type): Move contents to ... (cp_omp_mappable_type_1): ... here and add note output. (cp_omp_emit_unmappable_type_notes): New function. * semantics.c (finish_omp_clauses): Call cp_omp_emit_unmappable_type_notes in four places. 2019-07-03 Martin Liska * call.c (build_new_op_1): Remove dead assignemts. * typeck.c (cp_build_binary_op): Likewise. 2019-06-27 Jason Merrill PR c++/55442 - memory-hog with highly recursive constexpr. * constexpr.c (push_cx_call_context): Return depth. (cxx_eval_call_expression): Don't cache past constexpr_cache_depth. 2019-06-27 Jan Hubicka * class.c (layout_class_type): Set TYPE_CXX_ODR_P for as-base type copy. 2019-06-27 Martin Liska * class.c (adjust_clone_args): Remove obviously dead assignments. (dump_class_hierarchy_r): Likewise. * decl.c (check_initializer): Likewise. * parser.c (cp_parser_lambda_expression): Likewise. * pt.c (unify_bound_ttp_args): Likewise. (convert_template_argument): Likewise. * rtti.c (build_headof): Likewise. * typeck.c (convert_for_initialization): Likewise. 2019-06-25 Jason Merrill PR c++/70462 - unnecessary base ctor variant with final. * optimize.c (populate_clone_array): Skip base variant if CLASSTYPE_FINAL. (maybe_clone_body): We don't need an alias if we are only defining one clone. * class.c (resolves_to_fixed_type_p): Check CLASSTYPE_FINAL. 2019-06-25 Jakub Jelinek PR c++/90969 * constexpr.c (cxx_eval_array_reference): Don't look through VCE from vector type if lval. 2019-06-25 Jozef Lawrynowicz * lex.c (init_reswords): Create keyword for "__intN__" type. * cp-tree.h (cp_decl_specifier_seq): New bitfield "int_n_alt". * decl.c (grokdeclarator): Don't pedwarn about "__intN" ISO C incompatibility if alternate "__intN__" form is used. * parser.c (cp_parser_simple_type_specifier): Set decl_specs->int_n_alt if "__intN__" form is used. 2019-06-24 Jan Hubicka * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P. 2019-06-24 Jason Merrill * class.c (layout_class_type): Don't use a separate CLASSTYPE_AS_BASE if it's the same size. 2019-06-23 Marek Polacek * call.c (convert_default_arg): Use DEFERRED_PARSE instead of DEFAULT_ARG. * cp-objcp-common.c (cp_tree_size): Likewise. Use tree_deferred_parse instead of tree_default_arg. * cp-tree.def: Rename DEFAULT_ARG to DEFERRED_PARSE. * cp-tree.h: Rename DEFARG_TOKENS to DEFPARSE_TOKENS. Rename DEFARG_INSTANTIATIONS to DEFPARSE_INSTANTIATIONS. Rename tree_default_arg to tree_deferred_parse. (UNPARSED_NOEXCEPT_SPEC_P): Use DEFERRED_PARSE instead of DEFAULT_ARG. (cp_tree_node_structure_enum): Rename TS_CP_DEFAULT_ARG to TS_CP_DEFERRED_PARSE. (lang_tree_node): Rename tree_default_arg to tree_deferred_parse. Rename default_arg to deferred_parse. Use TS_CP_DEFERRED_PARSE instead of TS_CP_DEFAULT_ARG. (defarg_location): Remove declaration. (defparse_location): Add declaration. * decl.c (grokfndecl): Use DEFERRED_PARSE instead of DEFAULT_ARG. Call defparse_location instead of defarg_location. (check_default_argument): Use DEFERRED_PARSE instead of DEFAULT_ARG. (cp_tree_node_structure): Likewise. Use TS_CP_DEFERRED_PARSE instead of TS_CP_DEFAULT_ARG. * decl2.c (grokfield): Use DEFERRED_PARSE instead of DEFAULT_ARG. * error.c (dump_expr): Likewise. (location_of): Likewise. * init.c (get_nsdmi): Likewise. * parser.c (cp_parser_save_noexcept): Likewise. Use DEFPARSE_TOKENS instead of DEFARG_TOKENS. (cp_parser_late_noexcept_specifier): Likewise. (cp_parser_late_parse_one_default_arg): Use DEFPARSE_TOKENS instead of DEFARG_TOKENS. (cp_parser_late_parsing_default_args): Use DEFERRED_PARSE instead of DEFAULT_ARG. Use DEFPARSE_INSTANTIATIONS instead of DEFARG_INSTANTIATIONS. (cp_parser_cache_defarg): Use DEFERRED_PARSE instead of DEFAULT_ARG. Use DEFPARSE_TOKENS instead of DEFARG_TOKENS. Use DEFPARSE_INSTANTIATIONS instead of DEFARG_INSTANTIATIONS. (defparse_location): Renamed from defarg_location. * pt.c (tsubst_default_argument): Use DEFERRED_PARSE instead of DEFAULT_ARG. (tsubst_arg_types): Likewise. (dependent_type_p_r): Likewise. * tree.c (cp_tree_equal): Likewise. (cp_walk_subtrees): Likewise. * typeck.c (convert_arguments): Likewise. 2019-06-22 Marek Polacek PR c++/86476 - noexcept-specifier is a complete-class context. PR c++/52869 * cp-tree.def (DEFAULT_ARG): Update commentary. * cp-tree.h (UNPARSED_NOEXCEPT_SPEC_P): New macro. (tree_default_arg): Use tree_base instead of tree_common. (do_push_parm_decls, maybe_check_overriding_exception_spec): Declare. * decl.c (do_push_parm_decls): New function, broken out of... (store_parm_decls): ...here. Call it. * except.c (nothrow_spec_p): Accept DEFAULT_ARG in the assert. * parser.c (cp_parser_noexcept_specification_opt, cp_parser_late_noexcept_specifier, noexcept_override_late_checks): Forward-declare. (unparsed_noexcepts): New macro. (push_unparsed_function_queues): Update initializer. (cp_parser_direct_declarator): Pass FRIEND_P to cp_parser_exception_specification_opt. (inject_parm_decls): New. (pop_injected_parms): New. (cp_parser_class_specifier_1): Implement delayed parsing of noexcept-specifiers. (cp_parser_save_noexcept): New. (cp_parser_late_noexcept_specifier): New. (noexcept_override_late_checks): New. (cp_parser_noexcept_specification_opt): Add FRIEND_P parameter. Call cp_parser_save_noexcept instead of the normal processing if needed. (cp_parser_exception_specification_opt): Add FRIEND_P parameter and pass it to cp_parser_noexcept_specification_opt. (cp_parser_save_member_function_body): Fix comment. (cp_parser_save_default_args): Maybe save the noexcept-specifier to post process. (cp_parser_transaction): Update call to cp_parser_noexcept_specification_opt. (cp_parser_transaction_expression): Likewise. * parser.h (cp_unparsed_functions_entry): Add new field to carry a noexcept-specifier. * pt.c (dependent_type_p_r): Handle unparsed noexcept expression. * search.c (maybe_check_overriding_exception_spec): New function, broken out of... (check_final_overrider): ...here. Call maybe_check_overriding_exception_spec. * tree.c (canonical_eh_spec): Handle UNPARSED_NOEXCEPT_SPEC_P. (cp_tree_equal): Handle DEFAULT_ARG. PR c++/90881 - bogus -Wunused-value in unevaluated context. * cvt.c (convert_to_void): Don't emit unused warnings in an unevaluated context. 2019-06-22 Paolo Carlini * decl.c (grokdeclarator): Use id_loc, typespec_loc, and locations[ds_storage_class] in a few additional places. 2019-06-21 Paolo Carlini PR c++/90909 Revert: 2019-05-21 Paolo Carlini PR c++/67184 PR c++/69445 * call.c (build_over_call): Devirtualize when the final overrider comes from the base. 2019-06-21 Marek Polacek PR c++/61490 - qualified-id in friend function definition. * decl.c (grokdeclarator): Diagnose qualified-id in friend function definition. Improve location for diagnostics of friend functions. PR c++/60223 - ICE with T{} in non-deduced context. * pt.c (unify): Allow COMPOUND_LITERAL_P in a non-deduced context. PR c++/64235 - missing syntax error with invalid alignas. * parser.c (cp_parser_std_attribute_spec): Commit to tentative parse if there's a missing close paren. PR c++/90490 - fix decltype issues in noexcept-specifier. * except.c (build_noexcept_spec): Call instantiate_non_dependent_expr_sfinae before build_converted_constant_expr instead of calling instantiate_non_dependent_expr after it. Add processing_template_decl_sentinel. 2019-06-21 Jakub Jelinek PR c++/90950 * semantics.c (finish_omp_clauses): Don't reject references to incomplete types if processing_template_decl. 2019-06-19 Marek Polacek PR c++/60364 - noreturn after first decl not diagnosed. * decl.c (duplicate_decls): Give an error when a function is declared [[noreturn]] after its first declaration. * parser.c (cp_parser_std_attribute): Don't treat C++11 noreturn attribute as equivalent to GNU's. * tree.c (std_attribute_table): Add noreturn. 2019-06-19 Jakub Jelinek * cp-gimplify.c (cp_genericize_r): Handle OMP_CLAUSE_{IN,EX}CLUSIVE like OMP_CLAUSE_SHARED. 2019-06-18 Jason Merrill * constexpr.c (cxx_eval_store_expression): Delay target evaluation. 2019-06-18 Jason Merrill * constexpr.c (eval_and_check_array_index): Split out from... (cxx_eval_array_reference): ...here. (cxx_eval_store_expression): Use it here, too. (diag_array_subscript): Take location. Strip location wrapper. 2019-06-18 Jason Merrill * constexpr.c (cxx_eval_constant_expression): Handle conversion from and then to the same type. 2019-06-18 Jason Merrill * constexpr.c (unshare_constructor): Add MEM_STAT_DECL. 2019-06-17 Jakub Jelinek * semantics.c (finish_omp_clauses): For OMP_CLAUSE_REDUCTION_INSCAN set need_copy_assignment. 2019-06-17 Marek Polacek PR c++/83820 - excessive attribute arguments not detected. * parser.c (cp_parser_std_attribute): Detect excessive arguments. 2019-06-17 Nathan Sidwell PR c++/90754 * name-lookup.c (lookup_type_scope_1): Calll qualify_lookup before checking context. 2019-06-14 Marek Polacek PR c++/90884 - stray note with -Wctor-dtor-privacy. * class.c (maybe_warn_about_overly_private_class): Guard the call to inform. 2019-06-12 Jason Merrill PR c++/85552 - wrong instantiation of dtor for DMI. * typeck2.c (digest_nsdmi_init): Set tf_no_cleanup for direct-init. 2019-06-13 Paolo Carlini * decl.c (grokdeclarator): Use id_loc in five additional places in the last part of the function. 2019-06-13 Paolo Carlini * decl.c (grokdeclarator): Move further up the declaration of id_loc, use it immediately, update its value after the loop over declarator, use it again in the final part of function; improve locations of error messages about multiple data types and conflicting specifiers. 2019-06-13 Richard Biener PR c++/90801 * typeck2.c (split_nonconstant_init_1): Properly count num_split_elts, optimize single constructor elt removal. 2019-06-12 Marek Polacek PR c++/66999 - 'this' captured by reference. * parser.c (cp_parser_lambda_introducer): Reject `&this'. Use cp_lexer_nth_token_is instead of cp_lexer_peek_nth_token. PR c++/90825 - endless recursion when evaluating sizeof. PR c++/90832 - endless recursion when evaluating sizeof. * constexpr.c (cxx_eval_constant_expression): Don't recurse on the result of fold_sizeof_expr if is returns a SIZEOF_EXPR. * typeck.c (cxx_sizeof_expr): Only return a SIZEOF_EXPR if the operand is instantiation-dependent. PR c++/90736 - bogus error with alignof. * constexpr.c (adjust_temp_type): Use cv_unqualified type. 2019-06-11 Matthew Beliveau PR c++/90449 - add -Winaccessible-base option. * class.c (warn_about_ambiguous_bases): Changed name to: maybe_warn_about_inaccessible_bases. (maybe_warn_about_inaccessible_bases): Implemented new Winaccessible-base warning option for both direct and virtual base warnings. (layout_class_type): Call to warn_about_ambiguous_bases changed to fit new name. 2019-06-11 Richard Biener PR c++/90801 * typeck2.c (split_nonconstant_init_1): Avoid ordered remove from CONSTRUCTOR by marking to remove elements and doing all of them in a O(n) scan. 2019-06-11 Jakub Jelinek PR c++/90810 * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR. 2019-06-11 Martin Liska PR c++/87847 * pt.c (init_template_processing): Disable hash table sanitization for decl_specializations and type_specializations. 2019-06-10 Jason Merrill * constexpr.c (free_constructor): New. (cxx_eval_call_expression): Free parameter value CONSTRUCTORs. * constexpr.c (unshare_constructor): Only unshare if T is itself a CONSTRUCTOR. (cxx_eval_call_expression): Don't call it on the result here. Reduce constexpr_call memory consumption. * constexpr.c (cxx_bind_parameters_in_call): Use TREE_VEC rather than TREE_LIST. (constexpr_call_hasher::equal, cxx_bind_parameters_in_call) (cxx_eval_call_expression): Adjust. 2019-06-10 Jakub Jelinek * parser.c (cp_parser_omp_clause_reduction): Don't sorry_at on inscan reductions. (cp_parser_omp_scan_loop_body): New function. (cp_parser_omp_for_loop): Call cp_parser_omp_scan_loop_body if there are inscan reduction clauses. (cp_parser_pragma): Reject PRAGMA_OMP_SCAN. * semantics.c (finish_omp_clauses): Reject mixing inscan with non-inscan reductions on the same construct, or inscan reductions with ordered or schedule clauses, or inscan array reductions. * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,EX}CLUSIVE. (tsubst_expr): Handle OMP_SCAN. 2019-06-07 Jason Merrill * constexpr.c (cxx_eval_constant_expression): Call STRIP_ANY_LOCATION_WRAPPER early. [CONVERT_EXPR]: Don't build anything for conversion to void. [ADDR_EXPR]: ggc_free unused ADDR_EXPR. 2019-06-05 Martin Sebor PR c/90737 * typeck.c (maybe_warn_about_returning_address_of_local): Only consider functions returning pointers as candidates for -Wreturn-local-addr. 2019-06-05 Paolo Carlini * decl.c (smallest_type_location): New. (check_special_function_return_type): Use it. (grokdeclarator): Lkewise. 2019-06-05 Paolo Carlini * decl.c (grokdeclarator): Use locations[ds_friend] in one place. 2019-06-05 Martin Sebor * call.c (build_conditional_expr_1): Adjust quoting and hyphenation. (convert_like_real): Same. (convert_arg_to_ellipsis): Same. * constexpr.c (diag_array_subscript): Same. * constraint.cc (diagnose_trait_expression): Same. * cvt.c (ocp_convert): Same. * decl.c (start_decl): Same. (check_for_uninitialized_const_var): Same. (grokfndecl): Same. (check_special_function_return_type): Same. (finish_enum_value_list): Same. (start_preparsed_function): Same. * parser.c (cp_parser_decl_specifier_seq): Same. * typeck.c (cp_build_binary_op): Same. (build_static_cast_1): Same. 2019-06-04 Nina Dinka Ranns PR c++/63149 - Wrong auto deduction from braced-init-list. * pt.c (listify_autos): use non cv qualified auto_node in std::initializer_list. 2019-06-04 Paolo Carlini * decl.c (grokdeclarator): Use declarator->id_loc in two additional places. 2019-06-04 Nathan Sidwell * name-lookup.c (lookup_type_scope_1): Reimplement, handle local and namespace scopes separately. 2019-06-04 Harald van Dijk PR c++/60531 - Wrong error about unresolved overloaded function * typeck.c (cp_build_binary_op): See if overload can be resolved. (cp_build_unary_op): Ditto. 2019-06-04 Jason Merrill Reduce accumulated garbage in constexpr evaluation. * constexpr.c (cxx_eval_call_expression): ggc_free any bindings we don't save. (cxx_eval_increment_expression): ggc_free the MODIFY_EXPR after evaluating it. 2019-06-04 Jakub Jelinek * cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_ instead of only up to linear. 2019-06-03 Paolo Carlini * parser.c (cp_parser_unqualified_id): Use build_min_nt_loc in five places. 2019-06-01 Ville Voutilainen PR c++/85254 * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL. 2019-05-31 Nathan Sidwell * cp-tree.h (IDENTIFIER_LAMBDA_P): New. (TYPE_ANON_P): New. (LAMBDA_TYPE_P, TYPE_UNNAMED_P): Likewise. (LAMBDANAME_PREFIX, LAMBDANAME_FORMAT): Delete. (make_lambda_name): Don't declare. * error.c (dump_aggr_type): Check for lambdas before other anonymous names. * lambda.c (begin_lambda_type): Use make_anon_name. * cp-lang.c (cxx_dwarf_name): Lambda names smell anonymous. * mangle.c (write_local_name): Likewise. * name-lookup.c (lambda_cnt, make_lambda_name): Delete. 2019-05-30 Marek Polacek * cp-tree.h (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Fix a typo. 2019-05-31 Paolo Carlini * decl.c (grokdeclarator): Use declarator->id_loc in five error_at calls. 2019-05-29 Jakub Jelinek PR c++/90598 * tree.c (lvalue_kind): Return clk_none for expressions with with VOID_TYPE_P. 2019-05-29 Paolo Carlini PR c++/89875 * parser.c (cp_parser_sizeof_operand): When the type-id production did not work out commit to the tentative parse. 2019-05-29 Jakub Jelinek P1091R3 - Extending structured bindings to be more like var decls P1381R1 - Reference capture of structured bindings * decl.c (cp_maybe_mangle_decomp): Handle TREE_STATIC decls even at function scope. (cp_finish_decomp): Copy over various decl properties from decl to v[i] in the tuple case. (grokdeclarator): Allow static, thread_local and __thread for C++2a and use pedwarn instead of error for older standard revisions. Make other structured binding diagnostic messages more i18n friendly. 2019-05-28 Nathan Sidwell * decl.c (duplicate_decls): Assert a template newdecl has no specializations. 2019-05-28 Marek Polacek PR c++/90548 - ICE with generic lambda and empty pack. * pt.c (tsubst_copy_and_build): Handle pack expansion properly. 2019-05-28 Nathan Sidwell * cp-tree.h (make_anon_name): Drop declaration. (TYPE_UNNAMED_P): Use IDENTIFIER_ANON_P. * cp-lang.c (cxx_dwarf_name): Likewise. * class.c (find_flexarrays): Likewise. * decl.c (name_unnamed_type, xref_tag_1): Likewise. * error.c (dump_aggr_type): Likewise. * pt.c (push_template_decl_real): Likewise. * name-lookup.c (consider_binding_level): Likewise. (anon_cnt, make_anon_name): Delete. 2019-05-25 Marek Polacek PR c++/90572 - wrong disambiguation in friend declaration. * parser.c (cp_parser_constructor_declarator_p): Don't allow missing typename for friend declarations. 2019-05-23 Jonathan Wakely * cp-tree.h (CP_AGGREGATE_TYPE_P): Fix whitespace. * init.c (std_placement_new_fn_p): Remove outdated TODO comment that was resolved by r254694. 2019-05-22 Jason Merrill PR c++/20408 - unnecessary code for empty struct. * call.c (build_call_a): Use simple_empty_class_p. PR c++/86485 - -Wmaybe-unused with empty class ?: * cp-gimplify.c (simple_empty_class_p): Also true for MODIFY_EXPR. 2019-05-21 Paolo Carlini * parser.c (cp_parser_template_declaration_after_parameters): Use DECL_SOURCE_LOCATION in literal operator template errors. 2019-05-21 Paolo Carlini PR c++/67184 PR c++/69445 * call.c (build_over_call): Devirtualize when the final overrider comes from the base. 2019-05-21 Nathan Sidwell * name-lookup.c (do_nonmember_using_decl): Drop INSERT_P parameter. Document. (finish_nonmember_using_decl): Adjust do_nonmember_using_decl calls. Remove stray FIXME comment. * name-lookup.h (struct cp_binding_level): Drop usings field. (finish_namespace_using_decl, finish_local_using_decl): Replace with ... (finish_nonmember_using_decl): ... this. * name-lookup.c (push_using_decl_1, push_using_decl): (do_nonmember_using_decl): ... here. Add INSERT_P arg. Reimplement. (validate_nonmember_using_decl, finish_namespace_using_decl) (finish_local_using_decl): Replace with ... (finish_nonmember_using_decl): ... this. Drop DECL parm. * parser.c (cp_parser_using_declaration): Don't do lookup here. * pt.c (tsubst_expr): Do not do using decl lookup here. 2019-05-21 Eric Botcazou * decl2.c (cpp_check) : New case. 2019-05-20 Marek Polacek CWG 2094 - volatile scalars are trivially copyable. PR c++/85679 * tree.c (trivially_copyable_p): Don't check CP_TYPE_VOLATILE_P for scalar types. 2019-05-20 Marek Polacek * pt.c (convert_template_argument): Add a diagnostic for the [temp.arg]/2 ambiguity case. * name-lookup.c (finish_using_directive): Don't issue inform() if the warning didn't trigger. Add quoting. Tweak the inform message. 2019-05-20 Paolo Carlini * cp-tree.h: Remove remnants of CONV_NONCONVERTING. 2019-05-20 Nathan Sidwell * name-lookup.c (finish_namespace_using_directive) (finish_local_using_directive): Merge to ... (finish_using_directive): ... here. Handle both contexts. * name-lookup.h (finish_namespace_using_directive) (finish_local_using_directive): Replace with ... (finish_using_directive): ... this. * parser.c (cp_parser_using_directive): Adjust. * pt.c (tsubst_expr): Likewise. * cp-tree.h (struct lang_decl_ns): Remove usings field. (DECL_NAMESPACE_USING): Delete. * name-lookup.c (name_lookup::search_usings): Use namespace's binding scope. (name_lookup::queue_namespae): Likewise. (finish_namespace_using_directive, push_namespace): Likewise. (has_using_namespace_std_directive): Just search the entire binding stack. 2019-05-20 Jonathan Wakely PR c++/90532 Ensure __is_constructible(T[]) is false * method.c (is_xible_helper): Return error_mark_node for construction of an array of unknown bound. 2019-05-17 Thomas Schwinge PR c++/89433 * parser.c (cp_finalize_oacc_routine): Rework checking if already marked with an OpenACC 'routine' directive. PR c++/89433 * parser.c (cp_parser_oacc_routine) (cp_parser_late_parsing_oacc_routine): Normalize order of clauses. (cp_finalize_oacc_routine): Call oacc_verify_routine_clauses. PR c++/89433 * parser.c (cp_finalize_oacc_routine): Refer to OpenACC 'routine' clauses from "omp declare target" attribute. 2019-05-16 Martin Sebor * call.c (print_z_candidate): Wrap diagnostic text in a gettext macro. Adjust. (print_z_candidates): Same. (build_conditional_expr_1): Quote keywords, operators, and types in diagnostics. (build_op_delete_call): Same. (maybe_print_user_conv_context): Wrap diagnostic text in a gettext macro. (convert_like_real): Same. (convert_arg_to_ellipsis): Quote keywords, operators, and types in diagnostics. (build_over_call): Same. (joust): Break up an overlong line. Wrap diagnostic text in a gettext macro. * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English. (cxx_eval_constant_expression): Quote keywords, operators, and types in diagnostics. (potential_constant_expression_1): Same. * cp-gimplify.c (cp_genericize_r): Same. * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types in diagnostics. (type_promotes_to): Same. * decl.c (check_previous_goto_1): Same. (check_goto): Same. (start_decl): Same. (cp_finish_decl): Avoid parenthesizing a sentence for consistency. (grok_op_properties): Quote keywords, operators, and types in diagnostics. * decl2.c (grokfield): Same. (coerce_delete_type): Same. * except.c (is_admissible_throw_operand_or_catch_parameter): Same. * friend.c (do_friend): Quote C++ tokens. * init.c (build_new_1): Quote keywords, operators, and types in diagnostics. (build_vec_delete_1): Same. (build_delete): Same. * lex.c (parse_strconst_pragma): Same. (handle_pragma_implementation): Same. (unqualified_fn_lookup_error): Same. * mangle.c (write_type): Same. * method.c (defaulted_late_check): Avoid two consecutive punctuators. * name-lookup.c (cp_binding_level_debug): Remove a trailing newline. (pop_everything): Same. * parser.c (cp_lexer_start_debugging): Quote a macro name. in a diagnostic (cp_lexer_stop_debugging): Same. (cp_parser_userdef_numeric_literal): Quote a C++ header name in a diagnostic. (cp_parser_nested_name_specifier_opt): Quote keywords, operators, and types in diagnostics. (cp_parser_question_colon_clause): Same. (cp_parser_asm_definition): Same. (cp_parser_init_declarator): Same. (cp_parser_template_declaration_after_parameters): Avoid capitalizing a sentence in a diagnostic. (cp_parser_omp_declare_reduction): Quote keywords, operators, and types in diagnostics. (cp_parser_transaction): Same. * pt.c (maybe_process_partial_specialization): Replace second call to permerror with inform for consistency with other uses. (expand_integer_pack): Quote keywords, operators, and types in diagnostics. * rtti.c (get_typeid): Quote keywords, operators, and types in diagnostics. (build_dynamic_cast_1): Same. * semantics.c (finish_asm_stmt): Same. (finish_label_decl): Same. (finish_bases): Same. (finish_offsetof): Same. (cp_check_omp_declare_reduction): Same. (finish_decltype_type): Same. * tree.c (handle_init_priority_attribute): Same. Add detail to diagnostics. (maybe_warn_zero_as_null_pointer_constant): Same. * typeck.c (cp_build_binary_op): Quote keywords, operators, and types in diagnostics. (cp_build_unary_op): Same. (check_for_casting_away_constness): Same. (build_static_cast): Same. (build_const_cast_1): Same. (maybe_warn_about_returning_address_of_local): Same. (check_return_expr): Same. * typeck2.c (abstract_virtuals_error_sfinae): Same. (digest_init_r): Replace a tab with spaces in a diagnostic. (build_functional_cast): Quote keywords, operators, and types in diagnostics. 2019-05-15 Jakub Jelinek PR debug/90197 * cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT before the condition (or if missing or constant non-zero at the end of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression if any. Don't call protected_set_expr_location on incr if it already has a location. 2019-05-15 Marek Polacek CWG 2096 - constraints on literal unions. * class.c (check_field_decls): Initialize booleans directly. A union is literal if at least one of its non-static data members is of non-volatile literal type. 2019-05-15 Paolo Carlini * cp-tree.h (REFERENCE_VLA_OK): Remove. * lambda.c (build_capture_proxy): Remove use of the above. 2019-05-15 Paolo Carlini * call.c (perform_overload_resolution, build_new_method_call_1): Use OVL_P; remove redundant TEMPLATE_DECL checks. * decl.c (grokfndecl): Likewise. * mangle.c (write_expression): Likewise. * parser.c (cp_parser_template_id): Likewise. * pt.c (resolve_overloaded_unification, type_dependent_expression_p): Likewise. * search.c (build_baselink): Likewise. * tree.c (is_overloaded_fn, dependent_name, maybe_get_fns): Likewise. 2019-05-14 Paolo Carlini PR preprocessor/90382 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use min_location. 2019-05-13 Jason Merrill Use releasing_vec more broadly. * cp-tree.h (struct releasing_vec): Replace get_ref method with operator&. (vec_safe_push, vec_safe_reserve, vec_safe_length, vec_safe_splice): Forwarding functions for releasing_vec. (release_tree_vector): Declare but don't define. * call.c (build_op_delete_call, build_temp, call_copy_ctor) (perform_direct_initialization_if_possible): Use releasing_vec. * constexpr.c (cxx_eval_vec_init_1, cxx_eval_store_expression): Likewise. * cp-gimplify.c (cp_fold): Likewise. * cvt.c (force_rvalue, ocp_convert): Likewise. * decl.c (get_tuple_decomp_init): Likewise. * except.c (build_throw): Likewise. * init.c (perform_member_init, expand_default_init): Likewise. * method.c (do_build_copy_assign, locate_fn_flags): Likewise. * parser.c (cp_parser_userdef_char_literal) (cp_parser_userdef_numeric_literal) (cp_parser_userdef_string_literal) (cp_parser_perform_range_for_lookup) (cp_parser_range_for_member_function, cp_parser_omp_for_loop) (cp_parser_omp_for_loop_init): Likewise. * pt.c (tsubst_copy_and_build, do_class_deduction): Likewise. * semantics.c (calculate_direct_bases, calculate_bases) (finish_omp_barrier, finish_omp_flush, finish_omp_taskwait) (finish_omp_taskyield, finish_omp_cancel) (finish_omp_cancellation_point): Likewise. * tree.c (build_vec_init_elt, strip_typedefs, strip_typedefs_expr) (build_min_non_dep_op_overload): Likewise. * typeck.c (build_function_call_vec, cp_build_function_call_nary) (cp_build_modify_expr): Likewise. * typeck2.c (build_functional_cast): Likewise. 2019-05-11 Paolo Carlini * typeck.c (cp_build_function_call_vec): When mark_used fails unconditionally return error_mark_node. 2019-05-10 Paolo Carlini * decl.c (grokvardecl): Use an accurate location in error message about main as a global variable. 2019-05-10 Paolo Carlini * call.c (build_call_a): Use FUNC_OR_METHOD_TYPE_P. * cp-gimplify.c (cp_fold): Likewise. * cp-objcp-common.c (cp_type_dwarf_attribute): Likewise. * cp-tree.h (TYPE_OBJ_P, TYPE_PTROBV_P): Likewise. * cvt.c (perform_qualification_conversions): Likewise. * decl.c (grokdeclarator): Likewise. * decl2.c (build_memfn_type): Likewise. * mangle.c (canonicalize_for_substitution, write_type): Likewise. * parser.c (cp_parser_omp_declare_reduction): Likewise. * pt.c (check_explicit_specialization, uses_deducible_template_parms, check_cv_quals_for_unify, dependent_type_p_r): Likewise. * rtti.c (ptr_initializer): Likewise. * semantics.c (finish_asm_stmt, finish_offsetof, cp_check_omp_declare_reduction): Likewise. * tree.c (cp_build_qualified_type_real, cp_build_type_attribute_variant, cxx_type_hash_eq, cxx_copy_lang_qualifiers, cp_free_lang_data): Likewise. * typeck.c (structural_comptypes, convert_arguments, cp_build_addr_expr_1, unary_complex_lvalue, cp_build_c_cast, cp_build_modify_expr, comp_ptr_ttypes_real, type_memfn_rqual): Likewise. 2019-05-10 Marek Polacek PR c++/78010 - bogus -Wsuggest-override warning on final function. * class.c (check_for_override): Don't warn for final functions. 2019-05-10 Jakub Jelinek PR pch/90326 * config-lang.in (gtfiles): Remove c-family/c-lex.c, add c-family/c-cppbuiltin.c. 2019-05-09 Paolo Carlini PR c++/90382 Revert: 2018-04-26 Paolo Carlini * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use min_location. 2019-05-08 Nathan Sidwell Kill DECL_SAVED_FUNCTION_DATA . * cp-tree.h (language_function): Remove x_auto_return_pattern. (current_function_auto_return_pattern): Delete. (lang_decl_fn): Replace saved_language_function with saved_auto_return type. (DECL_SAVED_FUNCTION_DATA): Delete. (DECL_SAVED_AUTO_RETURN_TYPE): New. (FNDECL_USED_AUTO): Correct documentation. * decl.c (duplicate_decls): Adjust AUTO return handling. (start_preparsed_function): Replace current_function_auto_return_pattern with DECL_SAVED_AUTO_RETURN_TYPE. Remove DECL_SAVED_FUNCTION_DATA zapping. (finish_function): Likewise. (save_function_data): Delete. (fndecl_declared_return_type): Reimplement. * mangle.c (write_unqualified_name): Use DECL_SAVED_AUTO_RETURN_TYPE. * method.c (make_thunk, make_alias_for): Likewise. * parser.c (cp_parser_jump_statement): Likewise. * pt.c (do_auto_deduction): Likewise. * typeck.c (check_return_expr): Likewise. 2019-05-06 Jason Merrill PR c++/90171 - reorganize usual_deallocation_fn_p * call.c (struct dealloc_info): New. (usual_deallocation_fn_p): Take a dealloc_info*. (aligned_deallocation_fn_p, sized_deallocation_fn_p): Remove. (build_op_delete_call): Adjust. 2019-05-07 Jason Merrill PR c++/86485 - -Wmaybe-unused with empty class ?: * typeck.c (build_static_cast_1): Use cp_build_addr_expr. * pt.c (type_dependent_expression_p): A non-type template parm with a placeholder type is type-dependent. 2019-05-06 Marek Polacek PR c++/90265 - ICE with generic lambda. * pt.c (tsubst_copy_and_build): Use a dedicated variable for the last element in the vector. 2019-05-03 Martin Liska * call.c (build_aggr_conv): Use is_empty instead of elements () == 0 (and similar usages). * parser.c (cp_parser_lambda_introducer): Likewise. 2019-05-02 Nathan Sidwell * semantics.c (finish_id_expression_1): Remove unreachable code. 2019-05-01 Nathan Sidwell * name-lookup.h (get_class_binding_direct): Change final arg to bool. (get_class_binding): Likewise. * name-lookup.c (get_class_binding_direct): Replace TYPE_OR_FNS arg with WANT_TYPE bool. Simplify. (get_class_binding): Adjust final arg. * decl.c (reshape_init_class): Adjust get_class_binding calls. 2019-04-30 Nathan Sidwell * cp-objcp-common.c (cp_common_init_ts): Use MARK_TS_EXP for _EXPR nodes. Call c_common_init_ts. 2019-04-29 Nathan Sidwell * decl.c (duplicate_decls): Add whitespace, move comments into conditional blocks. * method.c (explain_implicit_non_constexpr): Refactor. * pt.c (check_explicit_specialization): Fix indentation. * semantics.c (process_outer_var_ref): Reformat. (finish_id_expression_1): Use STRIP_TEMPLATE. 2019-04-26 Jonathan Wakely PR c++/90243 - orphaned note in uninstantiated constexpr function * decl.c (check_for_uninitialized_const_var): Suppress notes if no error was shown. 2019-04-26 Paolo Carlini PR c++/90173 * decl.c (grokdeclarator): Set type to error_mark_node upon error about template placeholder type non followed by a simple declarator-id. 2019-04-26 Paolo Carlini * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use min_location. 2019-04-24 Jason Merrill PR c++/90227 - error with template parameter packs. * pt.c (coerce_template_parms): Do add empty pack when require_all_args. 2019-04-24 Richard Biener * call.c (null_ptr_cst_p): Order checks according to expensiveness. (conversion_null_warnings): Likewise. * typeck.c (same_type_ignoring_top_level_qualifiers_p): Return early if type1 == type2. 2019-04-22 Jason Merrill PR c++/87366 - wrong error with alias template. * typeck.c (structural_comptypes): When comparing_specializations, aliases are unequal. (comptypes): When comparing_specializations, do structural comparison. 2019-04-19 Jason Merrill PR c++/90190 - CTAD with list-constructor. * pt.c (do_class_deduction): Don't try the single element deduction if the single element is also a braced list. PR c++/90171 - ICE with destroying delete with size_t parm. * call.c (sized_deallocation_fn_p): New. Use it instead of second_parm_is_size_t in most cases. (second_parm_is_size_t): Don't check for aligned. 2019-04-19 Paolo Carlini PR c++/89900 * pt.c (fn_type_unification): When handling null explicit arguments do not special case non-parameter packs. 2019-04-19 Jakub Jelinek PR c++/90138 * pt.c (process_template_parm): Set decl to pushdecl result. If !is_non_type, also set parm to that. PR c/89888 * decl.c (struct cp_switch): Remove outside_range_p member. (push_switch): Don't clear it. (pop_switch): Adjust c_do_switch_warnings caller. (finish_case_label): Adjust c_add_case_label caller. PR c++/90108 * decl.c (duplicate_decls): If remove is main variant and DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE variant that has newdecl as TYPE_NAME if any. 2019-04-18 Jason Merrill PR c++/87554 - ICE with extern template and reference member. * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars. 2019-04-17 Jason Merrill PR c++/90047 - ICE with enable_if alias template. * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the hash table when we're in SFINAE context. 2019-04-17 Marek Polacek PR c++/90124 - bogus error with incomplete type in decltype. * typeck.c (build_class_member_access_expr): Check cp_unevaluated_operand. 2019-04-12 Jakub Jelinek PR c/89933 * decl.c (duplicate_decls): When newdecl's type is its main variant, don't try to remove it from the variant list, but instead assert it has no variants. 2019-04-12 Martin Sebor PR c/88383 PR c/89288 * parser.c (cp_parser_has_attribute_expression): Handle assignment expressions. 2019-04-12 Jason Merrill * call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR of PMF type. 2019-04-12 Marek Polacek * except.c (build_noexcept_spec): Use build_converted_constant_bool_expr instead of perform_implicit_conversion_flags. PR c++/87603 - constexpr functions are no longer noexcept. * constexpr.c (is_sub_constant_expr): Remove unused function. * cp-tree.h (is_sub_constant_expr): Remove declaration. * except.c (check_noexcept_r): Don't consider a call to a constexpr function noexcept. 2019-04-11 Jakub Jelinek PR translation/90035 * parser.h (struct cp_parser): Add type_definition_forbidden_message_arg member. * parser.c (cp_debug_parser): Print it. (cp_parser_check_type_definition): Pass parser->type_definition_forbidden_message_arg as second argument to error. (cp_parser_has_attribute_expression, cp_parser_sizeof_operand): Set parser->type_definition_forbidden_message_arg and use G_() with %qs for parser->type_definition_forbidden_message instead of building untranslatable message using concat. 2019-04-09 Jakub Jelinek PR translation/90011 * typeck2.c (check_narrowing): Remove trailing space from diagnostics. 2019-04-08 Marek Polacek * typeck2.c (digest_init_r): Don't condition the object slicing warning on flag_checking. 2019-04-08 Paolo Carlini PR c++/89914 * semantics.c (trait_expr_value): Don't use TYPE_NOTHROW_P when maybe_instantiate_noexcept fails. (classtype_has_nothrow_assign_or_copy_p): Likewise. * method.c (implicitly_declare_fn): Avoid passing error_mark_node to build_exception_variant. 2019-04-05 Marek Polacek PR c++/87145 - bogus error converting class type in template arg list. * pt.c (convert_nontype_argument): Don't call build_converted_constant_expr if it could involve calling a conversion function with a instantiation-dependent constructor as its argument. 2019-04-05 Martin Sebor PR bootstrap/89980 * decl.c (reshape_init_array_1): Avoid treating empty strings as zeros in array initializers. Use trivial_type_p () instead of TYPE_HAS_TRIVIAL_DFLT(). 2019-04-04 Jason Merrill PR c++/89948 - ICE with break in statement-expr. * constexpr.c (cxx_eval_statement_list): Jumping out of a statement-expr is non-constant. 2019-04-04 Jason Merrill PR c++/89966 - error with non-type auto tparm. * pt.c (do_auto_deduction): Clear tf_partial. 2019-04-04 Jason Merrill PR c++/86986 - ICE with TTP with parameter pack. * pt.c (coerce_template_parameter_pack): Only look at the type of a non-type parameter pack. (fixed_parameter_pack_p_1): Don't recurse into the type of a non-type parameter pack. (coerce_template_template_parms): Call add_outermost_template_args. 2019-04-04 Martin Sebor PR c++/89974 PR c++/89878 PR c++/89833 PR c++/47488 * decl.c (reshape_init_array_1): Strip trailing zero-initializers from arrays of trivial type and known size. * mangle.c (write_expression): Convert braced initializer lists to STRING_CSTs. (write_expression): Trim trailing zero-initializers from arrays of trivial type. (write_template_arg_literal): Mangle strings the same as braced initializer lists. 2019-04-03 Jason Merrill PR c++/81866 - ICE with member template and default targ. * pt.c (tsubst_template_decl): Handle getting a type from retrieve_specialization. PR c++/86586 - -fcompare-debug=-Wsign-compare. * typeck.c (cp_build_binary_op): Don't fold for -Wsign-compare. PR c++/89331 - ICE with offsetof in incomplete class. * semantics.c (finish_offsetof): Handle error_mark_node. * typeck.c (build_class_member_access_expr): Call complete_type_or_maybe_complain before converting to base. PR c++/89917 - ICE with lambda in variadic mem-init. * pt.c (make_pack_expansion): Change type_pack_expansion_p to false. 2019-04-01 Jason Merrill PR c++/86946 - ICE with function call in template argument. DR 1321 * pt.c (iterative_hash_template_arg) [CALL_EXPR]: Use dependent_name. 2019-04-01 Paolo Carlini PR c++/62207 * pt.c (tsubst_copy): Deal with lookup_name not returing a variable. 2019-03-31 Marek Polacek PR c++/89852 - ICE with C++11 functional cast with { }. * constexpr.c (fold_non_dependent_expr_template): New static function broken out of... (fold_non_dependent_expr): ...here. (fold_non_dependent_init): New function. * cp-tree.h (fold_non_dependent_init): Declare. * typeck2.c (massage_init_elt): Call fold_non_dependent_init instead of fold_non_dependent_expr. Don't call maybe_constant_init. 2019-03-30 Jason Merrill PR c++/89744 - ICE with specialization of member class template. * pt.c (lookup_template_class_1): If the partial instantiation is explicitly specialized, adjust. (maybe_process_partial_specialization): Also adjust CLASSTYPE_TI_ARGS. 2019-03-29 Jakub Jelinek PR sanitizer/89869 * typeck.c: Include gimplify.h. (cp_build_modify_expr) : Unshare rhs before using it for second time. Formatting fixes. 2019-03-29 Marek Polacek PR c++/89876 - ICE with deprecated conversion. * call.c (convert_like_real): Only give warnings with tf_warning. 2019-03-28 Marek Polacek PR c++/89612 - ICE with member friend template with noexcept. * pt.c (maybe_instantiate_noexcept): For function templates, use their template result (function decl). Don't set up local specializations. Temporarily turn on processing_template_decl. Update the template type too. PR c++/89836 - bool constant expression and explicit conversions. * call.c (build_converted_constant_expr_internal): New function, renamed from... (build_converted_constant_expr): ...this. New. (build_converted_constant_bool_expr): New. * cp-tree.h (build_converted_constant_bool_expr): Declare. * decl.c (build_explicit_specifier): Call build_converted_constant_bool_expr. 2019-03-28 Jakub Jelinek PR c++/89785 * constexpr.c (struct check_for_return_continue_data): New type. (check_for_return_continue): New function. (potential_constant_expression_1) : Walk SWITCH_STMT_BODY to find RETURN_EXPRs or CONTINUE_STMTs not nested in loop bodies and set *jump_target to that if found. 2019-03-27 Jason Merrill PR c++/89831 - error with qualified-id in const member function. * semantics.c (finish_non_static_data_member): Use object cv-quals in scoped case, too. PR c++/89421 - ICE with lambda in template parameter list. * parser.c (cp_parser_lambda_expression): Also reject a lambda in a template parameter list before C++20. * pt.c (type_dependent_expression_p): True for LAMBDA_EXPR. * semantics.c (begin_class_definition): Restore error about defining non-lambda class in template parm list. 2019-03-26 Jason Merrill PR c++/86932 - missed SFINAE with empty pack. * pt.c (coerce_template_parms): Don't add an empty pack if tf_partial. (fn_type_unification): Pass tf_partial to coerce_template_parms. PR c++/86429 - constexpr variable in lambda. PR c++/82643 PR c++/87327 * constexpr.c (cxx_eval_constant_expression): In a lambda function, try evaluating the captured variable directly. 2019-03-26 Jakub Jelinek PR c++/89796 * semantics.c (finish_omp_atomic): Add warning_sentinel for -Wunused-value around finish_expr_stmt call. 2019-03-25 Paolo Carlini PR c++/84661 PR c++/85013 * parser.c (cp_parser_binary_expression): Don't call cp_fully_fold to undo the disabling of warnings. 2019-03-25 Jason Merrill PR c++/87748 - substitution failure error with decltype. * pt.c (most_specialized_partial_spec): Clear processing_template_decl. 2019-03-25 Marek Polacek PR c++/89214 - ICE when initializing aggregates with bases. * typeck2.c (digest_init_r): Warn about object slicing instead of crashing. PR c++/89705 - ICE with reference binding with conversion function. * call.c (reference_binding): If the result of the conversion function is a prvalue of non-class type, use the cv-unqualified type. 2019-03-25 Nathan Sidwell * lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group. 2019-03-22 Jakub Jelinek PR c++/60702 * cp-tree.h (get_tls_wrapper_fn): Remove declaration. (maybe_get_tls_wrapper_call): Declare. * decl2.c (get_tls_wrapper_fn): Make static. (maybe_get_tls_wrapper_call): New function. * typeck.c (build_class_member_access_expr): Handle accesses to TLS variables. * semantics.c (finish_qualified_id_expr): Likewise. (finish_id_expression_1): Use maybe_get_tls_wrapper_call. * pt.c (tsubst_copy_and_build): Likewise. PR c++/87481 * constexpr.c (struct constexpr_ctx): Add constexpr_ops_count member. (cxx_eval_constant_expression): When not skipping, not constant class or location wrapper, increment *ctx->constexpr_ops_count and if it is above constexpr_loop_nest_limit, diagnose failure. (cxx_eval_outermost_constant_expr): Add constexpr_ops_count and initialize ctx.constexpr_ops_count to its address. (is_sub_constant_expr): Likewise. 2019-03-21 Jakub Jelinek PR c++/71446 * call.c (filed_in_pset): Change pset from hash_set * to hash_set &, adjust uses accordingly. (build_aggr_conv): Change pset from hash_set * to hash_set. Replace goto fail; with return NULL;, adjust pset uses. PR c++/89767 * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id variables, check for duplicates in this function. * lambda.c (add_capture): Don't check for duplicates nor use IDENTIFIER_MARKED. (register_capture_members): Don't clear IDENTIFIER_MARKED here. 2019-03-21 Paolo Carlini PR c++/89571 * method.c (after_nsdmi_defaulted_late_checks): Avoid passing error_mark_node to comp_except_specs. 2019-03-20 Jason Merrill PR c++/87480 - decltype of member access in default template arg * pt.c (type_unification_real): Accept a dependent result in template context. 2019-03-19 Martin Sebor PR tree-optimization/89688 * typeck2.c (store_init_value): Call braced_lists_to_string for more kinds of initializers. 2019-03-18 Jason Merrill PR c++/89630 - ICE with dependent using-decl as template arg. * tree.c (cp_tree_equal): Always return false for USING_DECL. PR c++/89761 - ICE with sizeof... in pack expansion. * pt.c (argument_pack_element_is_expansion_p): Handle ARGUMENT_PACK_SELECT. PR c++/89640 - GNU attributes on lambda. * parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes. PR c++/89682 - wrong access error in default argument. * pt.c (tsubst_default_argument): Don't defer access checks. 2019-03-18 Paolo Carlini PR c++/85014 * semantics.c (finish_non_static_data_member): Check return value of context_for_name_lookup and immediately return error_mark_node if isn't a type. 2019-03-17 Jason Merrill PR c++/89571 - ICE with ill-formed noexcept on constructor. * pt.c (maybe_instantiate_noexcept): Only return false if defaulted. (regenerate_decl_from_template): Use it for noexcept-specs. 2019-03-14 Jason Merrill * parser.c (cp_parser_decl_specifier_seq): Support C++20 concept-definition syntax without 'bool'. 2019-03-14 Jakub Jelinek PR c++/89512 * semantics.c (finish_qualified_id_expr): Reject variable templates. PR c++/89652 * constexpr.c (struct constexpr_ctx): Change save_exprs type from hash_set to vec. (cxx_eval_call_expression): Adjust for save_exprs being a vec instead of hash_set. (cxx_eval_loop_expr): Likewise. Truncate the vector after each removal of SAVE_EXPRs from values. (cxx_eval_constant_expression) : Call safe_push method on save_exprs instead of add. 2019-03-13 Jason Merrill PR c++/86521 - C++17 copy elision in initialization by constructor. * call.c (joust_maybe_elide_copy): New. (joust): Call it. 2019-03-13 Marek Polacek PR c++/88979 - further P0634 fix for constructors. * parser.c (cp_parser_decl_specifier_seq): Pass flags to cp_parser_constructor_declarator_p. (cp_parser_direct_declarator): Allow missing typename for constructor parameters. (cp_parser_constructor_declarator_p): Add FLAGS parameter. Pass it to cp_parser_type_specifier. PR c++/89686 - mixing init-capture and simple-capture in lambda. * parser.c (cp_parser_lambda_introducer): Give error when combining init-capture and simple-capture. PR c++/89660 - bogus error with -Wredundant-move. * typeck.c (maybe_warn_pessimizing_move): Only accept (T &) &arg as the std::move's argument. Don't call convert_for_initialization when warn_redundant_move isn't on. 2019-03-11 Jason Merrill PR c++/86521 - wrong overload resolution with ref-qualifiers. * call.c (build_user_type_conversion_1): Don't use a conversion to a reference of the wrong rvalueness for direct binding. 2019-03-11 Martin Liska * cvt.c (build_expr_type_conversion): Wrap apostrophes in gcc internal format with %'. * decl.c (check_no_redeclaration_friend_default_args): Likewise. (grokfndecl): Likewise. * name-lookup.c (do_pushtag): Likewise. * pt.c (unify_parameter_deduction_failure): Likewise. (unify_template_deduction_failure): Likewise. 2019-03-11 Martin Liska * call.c (convert_arg_to_ellipsis): Wrap an option name in a string format message and fix GNU coding style. (build_over_call): Likewise. * class.c (check_field_decl): Likewise. (layout_nonempty_base_or_field): Likewise. * constexpr.c (cxx_eval_loop_expr): Likewise. * cvt.c (type_promotes_to): Likewise. * decl.c (cxx_init_decl_processing): Likewise. (mark_inline_variable): Likewise. (grokdeclarator): Likewise. * decl2.c (record_mangling): Likewise. * error.c (maybe_warn_cpp0x): Likewise. * except.c (doing_eh): Likewise. * mangle.c (maybe_check_abi_tags): Likewise. * parser.c (cp_parser_diagnose_invalid_type_name): Likewise. (cp_parser_userdef_numeric_literal): Likewise. (cp_parser_primary_expression): Likewise. (cp_parser_unqualified_id): Likewise. (cp_parser_pseudo_destructor_name): Likewise. (cp_parser_builtin_offsetof): Likewise. (cp_parser_lambda_expression): Likewise. (cp_parser_lambda_introducer): Likewise. (cp_parser_lambda_declarator_opt): Likewise. (cp_parser_selection_statement): Likewise. (cp_parser_init_statement): Likewise. (cp_parser_decomposition_declaration): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_static_assert): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_namespace_definition): Likewise. (cp_parser_using_declaration): Likewise. (cp_parser_ctor_initializer_opt_and_function_body): Likewise. (cp_parser_initializer_list): Likewise. (cp_parser_type_parameter_key): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_try_block): Likewise. (cp_parser_std_attribute_spec): Likewise. (cp_parser_requires_clause_opt): Likewise. * pt.c (check_template_variable): Likewise. (check_default_tmpl_args): Likewise. (push_tinst_level_loc): Likewise. (instantiate_pending_templates): Likewise. (invalid_nontype_parm_type_p): Likewise. * repo.c (get_base_filename): Likewise. * rtti.c (typeid_ok_p): Likewise. (build_dynamic_cast_1): Likewise. * tree.c (maybe_warn_parm_abi): Likewise. 2019-03-08 Jakub Jelinek PR other/80058 * parser.c (cp_parser_template_declaration_after_parameters): Avoid one space before " at the end of line and another after " on another line in a string literal. PR tree-optimization/89550 * semantics.c (maybe_convert_cond): Only set TREE_NO_WARNING if warning_at returned true. * decl2.c (c_parse_final_cleanups): Likewise. * typeck.c (convert_for_assignment): Likewise. * decl.c (finish_function): Likewise. PR c++/89585 * parser.c (cp_parser_asm_definition): Just warn instead of error on volatile qualifier outside of function body. PR c++/89599 * constexpr.c (potential_constant_expression_1): Reject REINTERPRET_CAST_P NOP_EXPRs. PR c++/89622 * call.c (joust): Call print_z_candidate only if pedwarn returned true. 2019-03-07 Jason Merrill PR c++/88123 - lambda and using-directive. * name-lookup.c (op_unqualified_lookup) (maybe_save_operator_binding, discard_operator_bindings) (push_operator_bindings): New. * typeck.c (build_x_binary_op, build_x_unary_op): Call maybe_save_operator_binding. * decl.c (start_preparsed_function): Call push_operator_bindings. * tree.c (cp_free_lang_data): Call discard_operator_bindings. PR c++/88820 - ICE with CTAD and member template used in DMI. * pt.c (do_class_deduction): Handle parm used as its own arg. 2019-03-07 Jakub Jelinek PR c++/89585 * parser.c (cp_parser_asm_definition): Parse asm qualifiers even at toplevel, but diagnose them. 2019-03-06 Jason Merrill PR c++/89381 - implicit copy and using-declaration. * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider op= brought in by a using-declaration. 2019-03-06 Jakub Jelinek PR c++/87148 * init.c (build_value_init_noctor): Ignore flexible array members. 2019-03-06 Jason Merrill PR c++/89576 - if constexpr of lambda capture. * semantics.c (maybe_convert_cond): Do convert a non-dependent condition in a template. * typeck.c (condition_conversion): Handle being called in a template. 2019-03-06 Marek Polacek PR c++/87378 - bogus -Wredundant-move warning. * typeck.c (maybe_warn_pessimizing_move): See if the maybe-rvalue overload resolution would actually succeed. 2019-03-05 Jason Merrill * class.c (is_really_empty_class): Add ignore_vptr parm. (trivial_default_constructor_is_constexpr): Pass it. * call.c (build_over_call): Pass it. * constexpr.c (cxx_eval_constant_expression): Pass it instead of checking TYPE_POLYMORPHIC_P. (cxx_eval_component_reference, potential_constant_expression_1): Pass it. * cp-gimplify.c (simple_empty_class_p): Pass it. * init.c (expand_aggr_init_1): Pass it. 2019-03-04 Paolo Carlini PR c++/84605 * parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too. 2019-03-04 Jakub Jelinek PR c++/71446 * call.c (field_in_pset): New function. (build_aggr_conv): Handle CONSTRUCTOR_IS_DESIGNATED_INIT correctly. 2019-03-02 Jakub Jelinek PR c++/71446 * cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define. * parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list caller, set CONSTRUCTOR_IS_DESIGNATED_INIT. (cp_parser_initializer_list): Add designated parameter, set *designated to a bool whether any designators were parsed. * decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if needed. * pt.c (tsubst_copy_and_build): Likewise. * call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT, don't call build_list_conv, nor build_complex_conv, nor attempt to convert a single element initializer to scalar. 2019-03-01 Marek Polacek PR c++/89537 - missing location for error with non-static member fn. * call.c (resolve_args): Use EXPR_LOCATION. * typeck.c (build_class_member_access_expr): Use input_location. PR c++/89532 - ICE with incomplete type in decltype. * semantics.c (finish_compound_literal): Return error_mark_node if digest_init_flags returns error_mark_node. 2019-03-01 Jakub Jelinek Implement P1002R1, Try-catch blocks in constexpr functions PR c++/89513 * parser.c (cp_parser_ctor_initializer_opt_and_function_body): Diagnose constexpr ctor or function with function-try-block with pedwarn for c++17 and earlier. Formatting fix. (cp_parser_try_block): Use pedwarn instead of error and only for c++17 and earlier when try block appears in constexpr function. * constexpr.c (build_constexpr_constructor_member_initializers): Handle TRY_BLOCK here instead of erroring on it. 2019-02-28 Jason Merrill PR c++/88183 - ICE with .* fold-expression. * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling. PR c++/86969 - ICE with constexpr if and recursive generic lambdas. * class.c, lambda.c, pt.c: Revert earlier change. * lambda.c (add_capture): Don't special-case capture of dependent VLA. * name-lookup.c (print_binding_level): Print this_entity. 2019-02-27 Marek Polacek PR c++/88857 - ICE with value-initialization of argument in template. * call.c (convert_like_real): Don't call build_value_init in template. 2019-02-27 Jason Merrill PR c++/86969 - ICE with constexpr if and recursive generic lambdas. * semantics.c (process_outer_var_ref): Do capture dependent vars. * class.c (finish_struct): Only add TAG_DEFN if T is in current_function_decl. * lambda.c (vla_capture_type): Force the capture type out into the lambda's enclosing function. (add_capture): Pass in the lambda. * pt.c (tsubst_lambda_expr): complete_type a VLA capture type. 2019-02-27 Marek Polacek PR c++/89511 - ICE with using-declaration and unscoped enumerator. * parser.c (cp_parser_using_declaration): For an unscoped enum only use its context if it's not a function declaration. 2019-02-27 Paolo Carlini PR c++/89488 * method.c (process_subob_fn): When maybe_instantiate_noexcept returns false don't call merge_exception_specifiers. 2019-02-27 Paolo Carlini PR c++/88987 * parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE for a non-constant parsed expression. 2019-02-26 Jakub Jelinek PR c++/89481 * constexpr.c (cxx_eval_store_expression): When changing active union member, set no_zero_init. 2019-02-23 Marek Polacek PR c++/88294 - ICE with non-constant noexcept-specifier. * pt.c (maybe_instantiate_noexcept): Set up the list of local specializations. Set current_class_{ptr,ref}. 2019-02-22 David Malcolm PR c++/89390 * parser.c (cp_parser_unqualified_id): Capture and use locations for destructors. 2019-02-22 Marek Polacek PR c++/89420 - ICE with CAST_EXPR in explicit-specifier. * decl.c (build_explicit_specifier): Don't check processing_template_decl. Call instantiation_dependent_expression_p instead of value_dependent_expression_p. Call instantiate_non_dependent_expr_sfinae before build_converted_constant_expr instead of calling instantiate_non_dependent_expr after it. Add processing_template_decl_sentinel. 2019-02-22 Thomas Schwinge * parser.c (cp_parser_oacc_simple_clause): Remove parser formal parameter, move loc formal parameter to the front. Adjust all users. (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust all users. 2019-02-21 Jason Merrill PR c++/87685 - generic lambda 'this' capture error. * lambda.c (lambda_expr_this_capture): Change add_capture_p to int. (maybe_generic_this_capture): Pass -1. PR c++/88394 - ICE with VLA init-capture. * lambda.c (is_normal_capture_proxy): Check DECL_CAPTURED_VARIABLE. PR c++/88869 - C++17 ICE with CTAD and explicit specialization. * pt.c (do_class_deduction): Don't include explicit specialization args in outer_args. PR c++/89422 - ICE with -g and lambda in default arg in template. * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner. 2019-02-21 Jason Merrill PR c++/88419 - C++17 ICE with class template arg deduction. * pt.c (make_template_placeholder): Set TYPE_CANONICAL after CLASS_PLACEHOLDER_TEMPLATE. 2019-02-21 Jakub Jelinek PR c++/89285 * constexpr.c (struct constexpr_fundef): Add parms and result members. (retrieve_constexpr_fundef): Adjust for the above change. (register_constexpr_fundef): Save constexpr body with copy_fn, temporarily set DECL_CONTEXT on DECL_RESULT before that. (get_fundef_copy): Change FUN argument to FUNDEF with constexpr_fundef * type, grab body and parms/result out of constexpr_fundef struct and temporarily change it for copy_fn calls too. (cxx_eval_builtin_function_call): For __builtin_FUNCTION temporarily adjust current_function_decl from ctx->call context. Test !potential_constant_expression instead of !is_constant_expression. (cxx_bind_parameters_in_call): Grab parameters from new_call. Undo convert_for_arg_passing changes for TREE_ADDRESSABLE type passing. (cxx_eval_call_expression): Adjust get_fundef_copy caller. (cxx_eval_conditional_expression): For IF_STMT, allow then or else operands to be NULL. (label_matches): Handle BREAK_STMT and CONTINUE_STMT. (cxx_eval_loop_expr): Add support for FOR_STMT, WHILE_STMT and DO_STMT. (cxx_eval_switch_expr): Add support for SWITCH_STMT. (cxx_eval_constant_expression): Handle IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT, CONTINUE_STMT, SWITCH_STMT, BREAK_STMT and CONTINUE_STMT. For SIZEOF_EXPR, recurse on the result of fold_sizeof_expr. Ignore DECL_EXPR with USING_DECL operand. * lambda.c (maybe_add_lambda_conv_op): Build thisarg using build_int_cst to make it a valid constant expression. 2019-02-20 Jason Merrill PR c++/88690 - C++17 ICE with empty base in aggregate. * typeck2.c (process_init_constructor_record): Skip trivial initialization of an empty base. 2019-02-21 Richard Biener PR middle-end/89392 * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not make symtab process new functions here. 2019-02-20 Jason Merrill PR c++/87921 - wrong error with inline static data member. * decl2.c (finish_static_data_member_decl): Don't set DECL_IN_AGGR_P for a non-template inline variable. Do nothing for an already-instantiated variable. (c_parse_final_cleanups): Check DECL_IN_AGGR_P without DECL_INLINE_VAR_P. * decl.c (check_initializer): Likewise. (make_rtl_for_nonlocal_decl): Likewise. * pt.c (instantiate_decl): Likewise. * typeck2.c (store_init_value): Likewise. 2019-02-20 Jakub Jelinek PR c++/89403 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting for flag_syntax_only from here... * semantics.c (expand_or_defer_fn_1): ... here. PR c++/89405 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and DECL_COMMON, set DECL_INTERFACE_KNOWN. PR c++/89336 * constexpr.c (cxx_eval_store_expression): Diagnose changing of active union member for -std=c++17 and earlier. 2019-02-19 Jason Merrill PR c++/87513 - 'sorry' mangling PMF template-id. * mangle.c (write_expression): Handle SCOPE_REF to BASELINK. 2019-02-19 Jason Merrill PR c++/88380 - wrong-code with flexible array and NSDMI. * typeck2.c (process_init_constructor_record): Skip flexarrays. 2019-02-20 will wray PR c++/88572 - wrong handling of braces on scalar init. * decl.c (reshape_init_r): Allow braces around scalar initializer within aggregate init. Reject double braced-init of scalar variable. 2019-02-20 Paolo Carlini PR c++/84536 * pt.c (tsubst_init): Diagnose an initializer expanding to an empty list of expressions; tweak wrt dependent types. (regenerate_decl_from_template): For VAR_DECLs call tsubst_init instead of tsubst_expr. 2019-02-19 Jason Merrill PR c++/88368 - wrong 'use of deleted function' * method.c (walk_field_subobs): Remember errors from get_nsdmi. (get_defaulted_eh_spec): Call push_tinst_level. * pt.c (maybe_instantiate_noexcept): Keep error_mark_node. * typeck2.c (merge_exception_specifiers): Handle error_mark_node. 2019-02-19 Chung-Lin Tang PR c/87924 * parser.c (cp_parser_oacc_clause_wait): Add representation of wait clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments. 2019-02-19 Jakub Jelinek PR c++/89387 * lambda.c (maybe_generic_this_capture): Don't check DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs. PR c++/89391 * typeck.c (build_reinterpret_cast_1): Don't handle void to && conversion go through build_target_expr_with_type. PR c++/89390 * error.c (qualified_name_lookup_error): Only call suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE. 2019-02-19 Tom Honermann * name-lookup.c (get_std_name_hint): Added u8string as a name hint. 2019-02-18 Jason Merrill PR c++/89336 - multiple stores in constexpr stmt. * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or assigned value. * pt.c (check_explicit_specialization): If the declarator is a template-id, only check whether the arguments are dependent. Improve duplicate [[likely]] diagnostic. * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it to process_stmt_hotness_attribute. * cp-gimplify.c (process_stmt_hotness_attribute): Take attrs_loc. (genericize_if_stmt): Use likely/unlikely instead of predictor_name. 2019-02-17 Marek Polacek PR c++/89217 - ICE with list-initialization in range-based for loop. * constexpr.c (unshare_constructor): No longer static. * cp-tree.h (unshare_constructor): Declare. * semantics.c (finish_compound_literal): When dealing with a non-dependent expression in a template, return the original expression. Pass LOOKUP_NO_NARROWING to digest_init_flags. 2019-02-13 Marek Polacek PR c++/89297 - ICE with OVERLOAD in template. * semantics.c (finish_compound_literal): Call instantiate_non_dependent_expr_sfinae. 2019-02-13 Alexandre Oliva PR c++/86379 * cp-tree.h (USING_DECL_SCOPE): Use result rather than type. * name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE. * search.c (protected_accessible_p): Follow USING_DECL_DECLS. (shared_member_p): Likewise. (lookup_member): Likewise. * decl.c (grok_special_member_properties): Skip USING_DECLs. * semantics.c (finish_omp_declare_simd_methods): Likewise. (finish_qualified_id_expr): Do not call shared_member_p with a dependent expr. PR c++/87322 * pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting. Move cp_evaluated resetting before signature tsubsting. (gen_elem_of_pack_expansion_instantiation): Separate local specializations per index. 2019-02-13 David Malcolm PR c++/89036 * class.c (add_method): Drop destructor assertion. 2019-02-13 Paolo Carlini PR c++/88986 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as context (the first argument). * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION as context. 2019-02-12 Jason Merrill PR c++/89144 - link error with constexpr initializer_list. * call.c (convert_like_real) [ck_list]: Don't allocate a temporary array for an empty list. * typeck2.c (store_init_value): Don't use cxx_constant_init in a template. 2019-02-11 Jason Merrill PR c++/89241 - ICE with __func__ in lambda in template. * pt.c (enclosing_instantiation_of): Also check instantiated_lambda_fn_p for the template context. 2019-02-11 Marek Polacek PR c++/89212 - ICE converting nullptr to pointer-to-member-function. * pt.c (tsubst_copy_and_build) : Return early for null member pointer value. 2019-02-11 Jakub Jelinek PR c++/88977 * pt.c (convert_nontype_argument): Pass true as manifestly_const_eval to maybe_constant_value calls. 2019-02-11 Marek Polacek * typeck2.c (digest_init_r): Remove commented code. 2019-02-11 Martin Sebor PR c++/87996 * decl.c (compute_array_index_type_loc): Preserve signed sizes for diagnostics. Call valid_array_size_p instead of error. * init.c (build_new_1): Compute size for diagnostic. Call invalid_array_size_error (build_new): Call valid_array_size_p instead of error. 2019-02-07 Alexandre Oliva PR c++/86218 * call.c (compare_ics): Deal with ck_aggr in either cs. 2019-02-06 David Malcolm PR c++/71302 * call.c (get_location_for_expr_unwinding_for_system_header): New function. (conversion_null_warnings): Use it when getting locations for EXPR, effectively adding a call to get_location_for_expr_unwinding_for_system_header for -Wconversion-null and making use of EXPR_LOCATION for -Wzero-as-null-pointer-constant. 2019-02-05 Jakub Jelinek PR c++/89187 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on PARM_DECLs of the thunk. * lambda.c (maybe_add_lambda_conv_op): Likewise. 2019-02-05 Marek Polacek PR c++/89158 - by-value capture of constexpr variable broken. * call.c (convert_like_real) : Call mark_exp_read instead of mark_rvalue_use. 2019-02-05 Alexandre Oliva PR c++/87770 * pt.c (instantiates_primary_template_p): New. (type_dependent_expression_p): Use it. 2019-02-01 Jason Merrill PR c++/88761 - ICE with reference capture of constant. * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for non-proxy decls. 2019-02-01 Marek Polacek PR c++/88325 - ICE with invalid out-of-line template member definition. * parser.c (cp_parser_class_name): Don't call make_typename_type for overloads. 2019-02-01 Jakub Jelinek PR c++/87175 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false if require_open failed. 2019-01-31 Marek Polacek PR c++/89083, c++/80864 - ICE with list initialization in template. * constexpr.c (adjust_temp_type): Use copy_node and change the type instead of using build_constructor. * decl.c (reshape_init_r): Don't reshape a digested initializer. Return the initializer for COMPOUND_LITERAL_P. PR c++/88983 - ICE with switch in constexpr function. * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY. (cxx_eval_constant_expression) : Don't look for the label in the else branch if we found it in the then branch. 2019-01-30 Jason Merrill PR c++/88752 - ICE with lambda and constexpr if. * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New. * pt.c (tsubst_lambda_expr): Set it. (instantiated_lambda_fn_p): Check it. (enclosing_instantiation_of): Use it. 2019-01-31 Jakub Jelinek PR libstdc++/88170 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as a C cast in pp_c_flag_gnu_v3 mode. 2019-01-30 Jakub Jelinek PR c++/88988 * lambda.c (is_capture_proxy): Don't return true for DECL_OMP_PRIVATIZED_MEMBER artificial vars. 2019-01-30 Marek Polacek PR c++/89119 - ICE with value-initialization in template. * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR. 2019-01-29 Jason Merrill PR c++/86943 - wrong code converting lambda to function pointer. * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the call. Only forward parms for decltype. * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P specially. * typeck.c (check_return_expr): Don't mess with a thunk call. 2019-01-28 Jason Merrill PR c++/89089 - ICE with [[no_unique_address]]. PR c++/88865 - wrong layout with [[no_unique_address]]. * class.c (check_field_decls): A potentially-overlapping field makes the class non-layout-POD, but not non-empty. (end_of_class): Always consider empty data members. (layout_class_type): Set DECL_SIZE for empty fields. 2019-01-28 Marek Polacek PR c++/88358 - name wrongly treated as type. * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id in parameter-list is a type if the function's declarator-id is not qualified. 2019-01-27 Marek Polacek PR c++/88815 - narrowing conversion lost in decltype. PR c++/78244 - narrowing conversion in template not detected. * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New. * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with CONSTRUCTOR_IS_DEPENDENT instantiation-dependent. * semantics.c (finish_compound_literal): When the compound literal isn't instantiation-dependent and the type isn't type-dependent, fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT. PR c++/89024 - ICE with incomplete enum type. * call.c (standard_conversion): When converting an ARITHMETIC_TYPE_P to an incomplete type, return NULL. 2019-01-25 Paolo Carlini PR c++/88969 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1). * decl2.c (coerce_delete_type): Use build_pointer_type instead of TYPE_POINTER_TO. 2019-01-24 Jason Merrill PR c++/89001 - mangling of reference temporaries * cp-tree.h (struct saved_scope): Add ref_temp_count. (current_ref_temp_count): New macro. * mangle.c (mangle_ref_init_variable): Use it. * typeck2.c (store_init_value): Clear it. * call.c (make_temporary_var_for_ref_to_temp): Copy public and comdat. 2019-01-24 Jakub Jelinek PR c++/88976 * semantics.c (finish_omp_cancel): Diagnose more than one if on #pragma omp cancel with different modifiers. Use maybe_convert_cond when not in template or build_x_binary_op otherwise. 2019-01-23 Marek Polacek PR c++/88757 - qualified name treated wrongly as type. * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids in parameter-list as types if name lookup for declarator-id didn't find one or more function templates. 2019-01-23 Jakub Jelinek PR c/44715 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only after genericizing cond and incr expressions. PR c++/88984 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization before the begin_bc_block call. 2019-01-21 Jason Merrill PR c++/87893 - constexpr ctor ICE on ARM. PR c++/88293 - ICE with comma expression. * constexpr.c (initialized_type): Don't shortcut non-void type. Handle COMPOUND_EXPR. (cxx_eval_outermost_constant_expr): Return early for void type. 2019-01-21 Jakub Jelinek PR c++/88949 * optimize.c (cxx_copy_decl): New function. (clone_body): Use it instead of copy_decl_no_change. PR sanitizer/88901 * typeck.c (cp_build_binary_op): Don't instrument SANITIZE_POINTER_COMPARE if processing_template_decl. (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT. 2019-01-18 Jason Merrill PR c++/88875 - error with explicit list constructor. * call.c (reference_binding): Don't modify EXPR. Set need_temporary_p on the ck_user conversion for a temporary. (convert_like_real): Check it. 2019-01-18 H.J. Lu PR c/51628 PR c/88664 * call.c (convert_for_arg_passing): Upate the warn_for_address_or_pointer_of_packed_member call. * typeck.c (convert_for_assignment): Likewise. 2019-01-17 Jason Merrill PR c++/86205 - ICE with ?: of throw and template-id. * pt.c (resolve_nondeduced_context_or_error): Split out from... * typeck.c (decay_conversion): ...here. * call.c (build_conditional_expr_1): Use it. PR c++/86740, ICE with constexpr if and nested generic lambdas. * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR. 2019-01-17 Paolo Carlini * decl.c (grokdeclarator): Use typespec_loc in error messages about 'auto' and trailing return type. 2019-01-17 David Malcolm PR c++/88699 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on USING_DECLs. 2019-01-17 Nathan Sidwell PR c++/86610 * semantics.c (process_outer_var_ref): Only skip dependent types in templates. 2019-01-17 Alexandre Oliva PR c++/87768 * cp-tree.h (saved_scope): Add suppress_location_wrappers. * name-lookup.c (do_push_to_top_level): Save and reset it. (do_pop_from_top_level): Restore it. PR c++/86648 * pt.c (make_template_placeholder): Use auto_identifier. (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test. * error.c (dump_type): Handle template placeholders. * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise. PR c++/88146 * cvt.c (convert_to_void): Handle all cdtor calls as if returning void. 2019-01-16 Paolo Carlini * decl.c (grokdeclarator): Use locations[ds_storage_class] in error messages about ill-formed uses of mutable. 2019-01-16 Marek Polacek PR c++/78244 - narrowing conversion in template not detected. * call.c (perform_implicit_conversion_flags): Set IMPLICIT_CONV_EXPR_BRACED_INIT. * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New. * pt.c (tsubst_copy_and_build): Use it. 2019-01-15 David Malcolm PR c++/88795 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types fails. 2019-01-15 Paolo Carlini * decl.c (start_decl): Improve error location. * decl2.c (grokfield): Likewise. 2019-01-15 Paolo Carlini * decl.c (grokdeclarator): Move further up the location_t loc declaration and use the location when building a TYPE_DECL for a typedef name. * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error about an ill-formed bit-field as typedef. 2019-01-14 Marek Polacek PR c++/88830 - ICE with abstract class. * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR. Fix formatting. PR c++/88825 - ICE with bogus function return type deduction. * typeck.c (can_do_nrvo_p): Check error_mark_node. 2019-01-14 Tom Honermann Implement P0482R5, char8_t: A type for UTF-8 characters and strings * cvt.c (type_promotes_to): Handle char8_t promotion. * decl.c (grokdeclarator): Handle invalid type specifier combinations involving char8_t. * lex.c (init_reswords): Add char8_t as a reserved word. * mangle.c (write_builtin_type): Add name mangling for char8_t (Du). * parser.c (cp_keyword_starts_decl_specifier_p) (cp_parser_simple_type_specifier): Recognize char8_t as a simple type specifier. (cp_parser_string_literal): Use char8_array_type_node for the type of CPP_UTF8STRING. (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system headers. * rtti.c (emit_support_tinfos): type_info support for char8_t. * tree.c (char_type_p): Recognize char8_t as a character type. * typeck.c (string_conv_p): Handle conversions of u8 string literals of char8_t type. (check_literal_operator_args): Handle UDLs with u8 string literals of char8_t type. * typeck2.c (ordinary_char_type_p): New. (digest_init_r): Disallow initializing a char array with a u8 string literal. 2019-01-14 Martin Liska PR gcov-profile/88263 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION as location of the TLS wrapper. 2019-01-12 Paolo Carlini * decl.c (cp_finish_decl): Improve error location. * decl2.c (grokfield): Likewise, improve two locations. 2019-01-11 Marek Polacek PR c++/88692, c++/87882 - -Wredundant-move false positive with *this. * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't ADDR_EXPR. 2019-01-11 Jason Merrill PR c++/88312 - pack expansion of decltype. * pt.c (instantiation_dependent_r): A template non-type parameter pack is instantiation-dependent. 2019-01-11 Jason Merrill PR c++/88613 - ICE with use of const var in lambda. * expr.c (mark_use): Fix location wrapper handling. * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use. 2019-01-11 Tobias Burnus PR C++/88114 * decl2.c (maybe_emit_vtables): If needed, generate code for the destructor of an abstract class. (mark_used): Update comment for older function-name change. 2019-01-11 Paolo Carlini * decl.c (start_decl): Improve error location. (grokdeclarator): Likewise, improve two locations. 2019-01-09 Sandra Loosemore PR other/16615 * cp-tree.h: Mechanically replace "can not" with "cannot". * parser.c: Likewise. * pt.c: Likewise. 2019-01-08 Paolo Carlini * decl.c (grok_reference_init): Improve error location. (grokdeclarator): Likewise, improve two locations. 2019-01-08 Marek Polacek PR c++/88538 - braced-init-list in template-argument-list. * parser.c (cp_parser_template_argument): Handle braced-init-list when in C++20. PR c++/88548 - this accepted in static member functions. * parser.c (cp_debug_parser): Adjust printing of local_variables_forbidden_p. (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false. (cp_parser_primary_expression): When checking local_variables_forbidden_p, use THIS_FORBIDDEN or LOCAL_VARS_FORBIDDEN. (cp_parser_lambda_body): Update the type of local_variables_forbidden_p. Set it to 0 rather than false. (cp_parser_condition): Adjust call to cp_parser_declarator. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): New parameter. Use it. (cp_parser_direct_declarator): New parameter. Use it to set local_variables_forbidden_p. Adjust call to cp_parser_declarator. (cp_parser_type_id_1): Adjust call to cp_parser_declarator. (cp_parser_parameter_declaration): Likewise. (cp_parser_default_argument): Update the type of local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN rather than true. (cp_parser_member_declaration): Tell cp_parser_declarator if we saw 'static' or 'friend'. (cp_parser_exception_declaration): Adjust call to cp_parser_declarator. (cp_parser_late_parsing_default_args): Update the type of local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN rather than true. (cp_parser_cache_defarg): Adjust call to cp_parser_declarator. (cp_parser_objc_class_ivars): Likewise. (cp_parser_objc_struct_declaration): Likewise. (cp_parser_omp_for_loop_init): Likewise. * parser.h (cp_parser): Change the type of local_variables_forbidden_p to unsigned char. (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN): Define. 2019-01-08 Paolo Carlini * decl.c (start_decl): Improve permerror location. 2019-01-08 Jonathan Wakely Jakub Jelinek PR c++/88554 * decl.c (finish_function): For -Wreturn-type don't add a return *this; fixit hint if current_class_ref is NULL. Use a single if instead of two nested ones. 2019-01-07 Paolo Carlini * decl.c (start_decl): Improve two error_at locations. (expand_static_init): Likewise. 2019-01-07 Marek Polacek PR c++/88741 - wrong error with initializer-string. * decl.c (cp_complete_array_type): Strip any location wrappers. 2019-01-07 Bernd Edlinger PR c++/88261 PR c++/69338 PR c++/69696 PR c++/69697 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value. * typeck2.c (digest_init_r): Raise an error for non-static initialization of a flexible array member. (process_init_constructor, massage_init_elt, process_init_constructor_array, process_init_constructor_record, process_init_constructor_union, process_init_constructor): Add the flags parameter and pass it thru. (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to digest_init_flags for static decls. 2019-01-07 Jakub Jelinek PR c++/85052 * cp-tree.h (cp_build_vec_convert): Declare. * parser.c (cp_parser_postfix_expression): Parse __builtin_convertvector. * constexpr.c: Include fold-const-call.h. (cxx_eval_internal_function): Handle IFN_VEC_CONVERT. (potential_constant_expression_1): Likewise. * semantics.c (cp_build_vec_convert): New function. * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to IFN_VEC_CONVERT. 2019-01-03 Jakub Jelinek PR c++/88636 * decl.c (builtin_function_1): Return result of pushdecl_top_level or pushdecl rather than decl. 2019-01-03 Paolo Carlini * tree.c (handle_nodiscard_attribute): Improve warning location. 2019-01-02 Marek Polacek PR c++/88612 - ICE with -Waddress-of-packed-member. * call.c (convert_for_arg_passing): Only give warnings with tf_warning. * typeck.c (convert_for_assignment): Likewise. PR c++/88631 - CTAD failing for value-initialization. * typeck2.c (build_functional_cast): Try deducing the template arguments even if there are no arguments to deduce from. 2019-01-01 Jakub Jelinek Update copyright years. Copyright (C) 2019-2020 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.