2017-09-22 Eric Botcazou PR bootstrap/81926 * cp-objcp-common.c (cp_get_debug_type): Do only one lookup. 2017-09-22 Jakub Jelinek PR sanitizer/81929 * tree.c (struct replace_placeholders_t): Add pset field. (replace_placeholders_r): Call cp_walk_tree with d->pset as last argument instead of NULL. Formatting fix. (replace_placeholders): Add pset variable, add its address into data. Pass &pset instead of NULL to cp_walk_tree. 2017-09-22 David Malcolm * call.c (get_fndecl_argument_location): New function. (convert_like_real): Use it when complaining about argument type mismatches. * cp-tree.h (struct cp_parameter_declarator): Add "loc" field. * parser.c (make_parameter_declarator): Add "loc" param and use it to initialize the new field. (cp_parser_translation_unit): Add UNKNOWN_LOCATION for "loc" of the "no_parameters" parameter. (cp_parser_parameter_declaration_list): Set the location of the result of grokdeclarator to be the parameter's loc, assuming no errors. (cp_parser_parameter_declaration): Generate a location for the parameter and pass to make_parameter_declarator. 2017-09-20 Nathan Sidwell * name-lookup.c (member_name_cmp): Use DECL_UID for final ordering. 2017-09-20 Jakub Jelinek P0409R2 - allow lambda capture [=, this] * parser.c (cp_parser_lambda_introducer): For cxx2a don't pedwarn on redundant [=, this]. 2017-09-18 Jason Merrill PR c++/82069 - ICE with lambda in template * semantics.c (process_outer_var_ref): Check uses_template_parms instead of any_dependent_template_arguments_p. 2017-09-15 Manuel Lopez-Ibanez Paolo Carlini PR c++/64644 * decl2.c (finish_anon_union): Complain about "anonymous union with no members" with a pedwarn. 2017-09-15 Bernd Edlinger * typeck.c (build_reinterpret_cast_1, build_const_cast_1): Implement -Wcast-align=strict. 2017-09-15 Jakub Jelinek * decl.c (redeclaration_error_message): Use cxx17 instead of cxx1z, adjust diagnostics refering to C++1z or -std=gnu++1z or -std=c++1z to C++17 or -std=gnu++17 or -std=c++17. Adjust comments. (cxx_init_decl_processing, next_initializable_field, is_direct_enum_init, check_initializer, cp_finish_decl, mark_inline_variable, grokdeclarator, grokparms, xref_basetypes, finish_function): Likewise. * cp-tree.h (DECL_INLINE_VAR_P): Likewise. * pt.c (mark_template_parm, convert_nontype_argument, instantiate_class_template_1, type_unification_real, unify, get_partial_spec_bindings, dependent_type_p_r): Likewise. * typeck.c (cp_build_unary_op): Likewise. * constexpr.c (var_in_maybe_constexpr_fn): Likewise. * call.c (build_user_type_conversion_1, build_over_call, build_special_member_call): Likewise. * lambda.c (begin_lambda_type): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * class.c (build_base_field, finalize_literal_type_property, explain_non_literal_class): Likewise. * parser.c (cp_parser_diagnose_invalid_type_name, cp_parser_primary_expression, cp_parser_lambda_introducer, cp_parser_lambda_declarator_opt, cp_parser_selection_statement, cp_convert_range_for, cp_parser_perform_range_for_lookup, cp_parser_decomposition_declaration, cp_parser_linkage_specification, cp_parser_static_assert, cp_parser_simple_type_specifier, cp_parser_namespace_definition, cp_parser_using_declaration, cp_parser_init_declarator, cp_parser_type_parameter_key, cp_parser_exception_specification_opt, cp_parser_std_attribute_spec, cp_parser_constructor_declarator_p): Likewise. * mangle.c (struct globals): Rename need_cxx1z_warning to need_cxx17_warning. (write_exception_spec, start_mangling, mangle_decl): Likewise. * Make-lang.in (check-c++1z): Rename to check-c++17, depend on it. (check-c++17): New goal. Use 17 instead of 1z. (check-c++-all): Use 17 instead of 1z. 2017-09-14 Jakub Jelinek PR c++/81314 * cp-gimplify.c (omp_var_to_track): Look through references. (omp_cxx_notice_variable): Likewise. 2017-09-13 Nathan Sidwell Conv-op identifers not in identifier hash table * lex.c (conv_type_hasher): Make member fns inline. (make_conv_op_name): Directly clone conv_op_identifier. Rename CLASSTYPE_METHOD_VEC to CLASSTYPE_MEMBER_VEC. * cp-tree.h (struct lang_type): Rename methods to members. (CLASSTYPE_METHOD_VEC): Rename to ... (CLASSTYPE_MEMBER_VEC): ... this. * name-lookup.h (get_method_slot): Rename to ... (get_member_slot): ... this. (resort_type_method_vec): Rename to ... (resort_type_member_vec): ... this. * class.c (add_method, warn_hidden): Adjust. * search.c (dfs_locate_field_accessor_pre): Adjust. * name-lookup.c (method_vec_binary_search): Rename to ... (member_vec_binary_search): ... this and adjust. (method_vec_linear_search): Rename to ... (member_vec_linear_search): ... this and adjust. (fields_linear_search, get_class_binding_direct): Adjust. (get_method_slot): Rename to ... (get_member_slot): ... this and adjust. (method_name_slot): Rename to ... (member_name_slot): ... this and adjust. (resort_type_method_vec): Rename to ... (resort_type_member_vec): ... this and adjust. (method_vec_append_class_fields): Rename to ... (member_vec_append_class_fields): ... this and adjust. (method_vec_append_enum_values): Rename to ... (member_vec_append_enum_values): ... this and adjust. (method_vec_dedup): Rename to ... (member_vec_dedup): ... this and adjust. (set_class_bindings, insert_late_enum_def_bindings): Adjust. 2017-09-12 Paolo Carlini PR c++/70621 * decl.c (start_decl): Early return error_mark_node if duplicate_decls returns it; avoid misleading error message. 2017-09-12 Nathan Sidwell Kill CLASSTYPE_SORTED_FIELDS. * cp-tree.h (struct lang_type): Lose sorted_fields member. (CLASSTYPE_SORTED_FIELDS): Delete. * name-lookup.h (set_class_bindings): Add EXTRA arg. * name-lookup.c (fields_linear_search): New, broken out of ... (lookup_field_1): ... here. Delete remainder of function. (get_class_binding_direct): Reimplement without sorted_fields. (get_class_binding): Rename TYPE arg to KLASS, for consistency. (get_method_slot): Call set_class_binding when creating method_vec on complete type. (method_name_cmp): Order identically named slots. (sorted_fields_type_new): Delete. (field_vc_append_class_fields): Rename to ... (method_vec_append_class_fields): ... here. Adjust. (field_vec_append_enum_values): Renme to ... (method_vec_append_enum_values): ... here. Adjust. (method_vec_dedup): New. (set_class_bindings): Reimplement. (insert_late_enum_def_bindings): Reimplement. * name-lookup.c (get_class_binding): Rename TYPE arg to KLASS for consistency. (restort_data): Move later. (method_name_cmp, resort_method_name_cmp): Simplify. (resort_type_method_vec): Reformat. 2017-09-09 Jason Merrill * constexpr.c (reduced_constant_expression_p): If CONSTRUCTOR_NO_IMPLICIT_ZERO, check that all fields are initialized. 2017-09-09 Eric Botcazou PR bootstrap/81926 * cp-objcp-common.c (struct debug_type_hasher): New class. (debug_type_hash): New variable. (cp_get_debug_type): Associate the OFFSET_TYPEs with the types. 2017-09-08 Jason Merrill PR c++/70029 - ICE with ref-qualifier and -flto * tree.c (cxx_copy_lang_qualifiers): New. * cp-tree.h: Declare it. * cp-objcp-common.h: Define LANG_HOOKS_COPY_LANG_QUALIFIERS. 2017-09-06 Jason Merrill PR c++/82053 - ICE with default argument in lambda in template * pt.c (tsubst_arg_types): Substitute default arguments for lambdas in templates. (retrieve_specialization): Use lambda_fn_in_template_p. * cp-tree.h: Declare it. PR c++/82070 - error with nested lambda capture * pt.c (tsubst_expr) [DECL_EXPR]: Register capture proxies with register_local_specialization. 2017-09-06 Nathan Sidwell * name-lookup.h (lookup_field_1): Delete. (get_class_binding_direct, get_class_binding): Add type_or_fns arg. * name-lookup.c (lookup_field_1): make static (method_vec_binary_search, method_vec_linear_search): New. Broken out of ... (get_class_binding_direct): ... here. Add TYPE_OR_FNS argument. Do complete search of this level. (get_class_binding): Adjust. * decl.c (reshape_init_class): Call get_class_binding. * search.c (lookup_field_r): Move field searching into get_class_binding_direct. * class.c (warn_hidden): Don't barf on non-functions. * decl2.c (check_classfn): Likewise. Check template match earlier. * name-lookup.c (count_fields): Rename to ... (count_class_fields): ... here. Take a class, don't count NULL-named fields. (add_fields_to_record_type): Rename to ... (field_vec_append_class_fields): ... here. Take a class, don't add NULL-named fields. (add_enum_fields_to_record_type): Rename to ... (field_vec_append_enum_values): ... here. (set_class_bindings): Adjust, assert we added expected number. (insert_late_enum_def_bindings): Reimplement. Create vector if there are now sufficient entries. * name-lookup.h (lookup_fnfields_slot_nolazy, lookup_fnfields_slot): Rename to ... (get_class_binding_direct, get_class_binding): ... here. * name-lookup.c (lookup_fnfields_slot_nolazy, lookup_fnfields_slot): Rename to ... (get_class_binding_direct, get_class_binding): ... here. * cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Adjust. * call.c (build_user_type_conversion_1): Adjust. (has_trivial_copy_assign_p): Adjust. (has_trivial_copy_p): Adjust. * class.c (get_basefndecls) Adjust. (vbase_has_user_provided_move_assign) Adjust. (classtype_has_move_assign_or_move_ctor_p): Adjust. (type_build_ctor_call, type_build_dtor_call): Adjust. * decl.c (register_dtor_fn): Adjust. * decl2.c (check_classfn): Adjust. * pt.c (retrieve_specialization): Adjust. (check_explicit_specialization): Adjust. (do_class_deduction): Adjust. * search.c (lookup_field_r): Adjust. (look_for_overrides_here, lookup_conversions_r): Adjust. * semantics.c (classtype_has_nothrow_assign_or_copy_p): Adjust. * tree.c (type_has_nontrivial_copy_init): Adjust. * method.c (lazily_declare_fn): Adjust comment. 2017-09-05 Nathan Sidwell * name-lookup.c (do_class_using_decl): Elide read-once temps. Move declarations to initializations. * class.c (add_method): Move slot search and insertion to ... * name-lookup.c (get_method_slot): ... this new function. (lookup_fnfields_slot_nolazy): Cope with NULL slot. * name-lookup.h (get_method_slot): Declare. * decl.c (cxx_init_decl_processinng): Give conv_op_marker a more realistic type. (grok_special_member_properties): Set TYPE_HAS_CONVERSION. Expicitly look at DECL_NAME for specialness. Improve TYPE_HAS_CONSTEXPR_CTOR setting. * cp-tree.h (lang_decl_base): Rename template_conv_p to unknown_bound_p. (DECL_CONV_FN_P): Don't check NULL DECL_NAME. (DECL_CONV_FN_TYPE): FN must be conv op. (DECL_TEMPLATE_CONV_FN_P): Delete. (VAR_HAD_UNKNOWN_BOUND, SET_VAR_HAD_UNKNOWN_BOUND): Adjust. * pt.c (push_template_decl_real): Delete DECL_TEMPLATE_CONV_FN_P setting. * class.c (unreverse_member_declarations): Remove extraneous if. * pt.c (push_template_decl_real): Use string concatenation, not \. Add %<..%>. 2017-09-05 Paolo Carlini PR c++/81942 * cp-tree.h (LABEL_DECL_CDTOR): Add and document. * decl.c (start_preparsed_function): Set LABEL_DECL_CDTOR when creating cdtor_label. * constexpr.c (returns): Add the case of a constructor/destructor returning via a LABEL_DECL_CDTOR label. (cxx_eval_constant_expression, case [GOTO_EXPR]): Likewise. 2017-09-01 Nathan Sidwell * cp-tree.h (resort_type_method_vec): Move declaration to ... * name-lookup.h (resort_type_method_vec): ... here. (set_class_bindings): Lose 2nd arg. * class.c (finish_struct_1, finish_struct): Adjust set_class_bindings call. Don't call finish_struct_methods. (resort_data, method_name_cmp, resort_method_name_cmp, resort_type_method_vec, finish_struct_methods): Move to ... * name-lookup.c (resort_data, method_name_cmp, resort_method_name_cmp, resort_type_method_vec): ... here. (set_class_bindings): Lose fields arg. Swallow finish_struct_methods. * class.c (finish_struct): Call set_class_bindings for the template case too. * class.c (finish_struct_methods): Dont clear DECL_IN_AGGR_P here. Don't call maybe_warn_about_overly_private_class here. (warn_hidden): Cleanup declarations and comments. (type_has_user_provided_constructor): No need to check CLASSTYPE_METHOD_VEC. (type_has_user_provided_or_explicit_constructor): Likewise. (classtype_has_move_assign_or_move_ctor_p): Likewise. (check_bases_and_members): Don't call finish_struct_methods here. (finish_struct_1): Call finish_struct_methods and set_class_bindings immediately after layout. Clear DECL_IN_AGGR_P here. (finish_struct): For templates process USING_DECLS and clear DECL_IN_AGGR_P before calling finish_struct_methods. Call maybe_warn_about_overly_private_class here. Revert 2017-08-28 Nathan Sidwell Restore sorted_fields vector. * cp-tree.h (lang_type): Restore sorted_fields vector. (CLASSTYPE_SORTED_FIELDS): Restore. (CLASSTYPE_BINDINGS): Delete. * name-lookup.c (lookup_field_1): Restore binary search. (sorted_fields_type_new, count_fields, add_fields_to_record_type, add_enum_fields_to_record_type): Restore (set_class_bindings): Revert. (insert_late_enum_def_binding): Restore field_vec insertion. 2017-09-01 Jakub Jelinek PR c/81887 * parser.c (cp_parser_omp_ordered): Handle -fopenmp-simd. 2017-09-01 Marek Polacek PR c++/82040 * typeck.c (cp_build_unary_op): Avoid re-entering reporting routines. 2017-08-30 Jason Merrill PR c++/82029 - __PRETTY_FUNCTION__ in lambda in template * pt.c (enclosing_instantiation_of, lambda_fn_in_template_p) (regenerated_lambda_fn_p): New. (tsubst_decl) [VAR_DECL]: Use enclosing_instantiation_of. (tsubst_copy) [VAR_DECL]: Likewise. PR c++/82030 - ICE inheriting from multiple lambdas PR c++/80767 * call.c (compare_ics): Handle null candidate. 2017-08-30 Ville Voutilainen Make taking the address of an overloaded function a non-deduced context * pt.c (unify_overload_resolution_failure): Remove. (unify_one_argument): Adjust. 2017-08-30 Richard Sandiford Alan Hayward David Sherwood * typeck.c (cp_build_binary_op): Use SCALAR_TYPE_MODE. 2017-08-30 Richard Sandiford Alan Hayward David Sherwood * cvt.c (cp_convert_to_pointer): Use SCALAR_INT_TYPE_MODE. 2017-08-30 Richard Sandiford Alan Hayward David Sherwood * mangle.c (write_real_cst): Use SCALAR_FLOAT_TYPE_MODE instead of TYPE_MODE. 2017-08-29 Jason Merrill PR c++/81236 - ICE with template-id in generic lambda * semantics.c (finish_id_expression): Remove special dependent case. Avoid some later pieces when dependent. (finish_qualified_id_expr): Do normal BASELINK handling in a template. Always build a SCOPE_REF for a destructor BIT_NOT_EXPR. (parsing_default_capturing_generic_lambda_in_template): Remove. * parser.c (cp_parser_postfix_dot_deref_expression): Always give an error for types that will never be complete. * mangle.c (write_expression): Add sanity check. * tree.c (build_qualified_name): Add sanity check. (cp_walk_subtrees): Walk into the class context of a BASELINK. * lambda.c (add_capture): Improve diagnostic for generic lambda capture failure. * call.c (build_new_method_call_1): Print the right constructor name. Reimplement handling of lambdas in templates. * cp-tree.h (LAMBDA_FUNCTION_P): Check DECL_DECLARES_FUNCTION_P. * decl.c (start_preparsed_function): Call start_lambda_scope. (finish_function): Call finish_lambda_scope. * init.c (get_nsdmi): Call start/finish_lambda_scope. * lambda.c (start_lambda_scope): Only ignore VAR_DECL in a function. * parser.c (cp_parser_function_definition_after_declarator): Don't call start/finish_lambda_scope. * pt.c (retrieve_specialization): Ignore lambda functions in templates. (find_parameter_packs_r): Ignore capture proxies. Look into lambdas. (check_for_bare_parameter_packs): Allow bare packs in lambdas. (tsubst_default_argument): Call start/finish_lambda_scope. (tsubst_function_decl): Handle lambda functions differently. (tsubst_template_decl): Likewise. (tsubst_expr) [DECL_EXPR]: Skip closure declarations and capture proxies. (tsubst_lambda_expr): Create a new closure rather than instantiate the one from the template. (tsubst_copy_and_build): Don't register a specialization of a pack. (regenerate_decl_from_template): Call start/finish_lambda_scope. (instantiate_decl): Remove special lambda function handling. * semantics.c (process_outer_var_ref): Remove special generic lambda handling. Don't implicitly capture in a lambda in a template. Look for an existing proxy. * class.c (current_nonlambda_class_type): Use decl_type_context. * cp-tree.h (LAMBDA_EXPR_CLOSURE): Use TREE_TYPE. (LAMBDA_EXPR_RETURN_TYPE): Remove. (struct tree_lambda_expr): Remove closure and return_type fields. * lambda.c (build_lambda_expr): Don't set LAMBDA_EXPR_RETURN_TYPE. * pt.c (tsubst_copy_and_build): Likewise. * parser.c (cp_parser_lambda_declarator_opt): Track return type. (cp_parser_lambda_body): Adjust unspecified return type check. * ptree.c (cxx_print_lambda_node): Don't print closure or return type. PR c++/80935 - wrong C++17 error with lambda * decl.c (check_for_uninitialized_const_var): Check is_instantiation_of_constexpr. * constexpr.c (ensure_literal_type_for_constexpr_object): Check is_instantiation_of_constexpr. (potential_constant_expression_1): Check var_in_maybe_constexpr_fn. * lambda.c (build_lambda_object): Check for error_mark_node. * pt.c (make_pack_expansion): Set PACK_EXPANSION_LOCAL_P on the type pack as well. (tsubst_decl) [FUNCTION_DECL]: Set DECL_CONTEXT on the parameters. (tsubst) [TEMPLATE_PARM_INDEX]: Check for error_mark_node. PR c++/80767 - unnecessary instantiation of generic lambda * call.c (convert_like_real): Call build_user_type_conversion_1 if cand is null. (add_conv_candidate): Build a ck_user conversion with no candidate. Fix lambdas in template default argument of inherited ctor. * method.c (synthesized_method_base_walk): Replace an inherited template with its specialization. (synthesized_method_walk): Make inheriting_ctor a pointer. (maybe_explain_implicit_delete, explain_implicit_non_constexpr) (deduce_inheriting_ctor, implicitly_declare_fn): Adjust. * pt.c (build_deduction_guide): Set DECL_ABSTRACT_ORIGIN on the template, not the function. (template_guide_p): Adjust. Support copying local_specializations. * cp-tree.h (enum lss_policy): New. (local_specialization_stack): Add policy parameter to default ctor. * pt.c (local_specialization_stack): Copy local_specializations if lss_copy. * constexpr.c (potential_constant_expression_1): Add "now" parm. (is_constant_expression, require_constant_expression): New. (is_static_init_expression, is_nondependent_constant_expression) (is_nondependent_static_init_expression): Drop "potential". * except.c (build_must_not_throw_expr): Do type conversion on value-dependent argument. * pt.c, semantics.c, typeck2.c: Use variants without "potential". Instantiate default arguments/member initializers once. * init.c (get_nsdmi): Remember NSDMI instantiations. * parser.c (inject_this_parameter): Be more picky about current_class_ptr. * pt.c (tsubst_copy): Simplify 'this' handling. (tsubst_default_argument): Remember default argument instantiations. Take parameter number. (tsubst_default_arguments): Pass it. * call.c (convert_default_arg): Likewise. Fix default argument conversion failure and SFINAE. * call.c (build_over_call): Check convert_default_arg result for error_mark_node. * parser.c (cp_parser_late_parsing_default_args): Remember error_mark_node. 2017-08-28 Nathan Sidwell * cp-tree.h (lang_type): Replace sorted_fields vector with bindings map. (CLASSTYPE_SORTED_FIELDS): Delete. (CLASSTYPE_BINDINGS): New. * decl.c (finish_enum_value_list): Swap args of insert_late_enum_def_bindings. * name-lookup.c (lookup_field_1): Replace binary search of sorted fields with map->get. (sorted_fields_type_new, count_fields, add_fields_to_record_type, add_enum_fields_to_record_type): Delete. (add_class_member, add_class_members): New. (set_class_bindings): Create map and insert. (insert_late_enum_def_binding): Swap parms. Use add_clasS_member. * ptree.c (cxx_print_type): Delete sorted fields printing. * cp-tree.h (insert_late_enum_def_into_classtype_sorted_fields): Delete. * name-lookup.h (set_class_bindings, insert_late_enum_def_bindings): Declare. * decl.c (finish_enum_value_list): Adjust for insert_late_enum_def_bindings name change. * class.c (finish_struct_1): Call set_class_bindings. (count_fields, add_fields_to_record_type, add_enum_fields_to_record_type, sorted_fields_type_new, insert_into_classtype_sorted_fields, insert_late_enum_def_into_classtype_sorted_fields): Move to ... * name-lookup.h (count_fields, add_fields_to_record_type, add_enum_fields_to_record_type, sorted_fields_type_new, set_class_bindings, insert_late_enum_def_bindings): ... here. 2017-08-25 Nathan Sidwell * class.c (method_name_cmp, resort_method_name_cmp): Methods can never be NULL. Conversion operators have a special name * cp-tree.h (CPTI_CONV_OP_MARKER, CPTI_CONV_OP_IDENTIFIER): New. (conv_op_marker, conv_op_identifier): New. (CLASSTYPE_FIRST_CONVERSION_SLOT): Delete. * decl.c (initialize_predefined_identifiers): Add conv_op_identifier. (cxx_init_decl_processing): Create conv_op_marker. * decl2.c (check_classfn): Lookup conv-ops by name. * class.c (add_method): Use conv_op_identifier & conv_op_marker. (resort_type_method_vec): Don't skip conv-ops. (finish_struct_methods, warn_hidden): Likewise. * name-lookup.h (lookup_all_conversions): Delete. * name-lookup.c (lookup_conversion_operator): Replace with ... (extract_conversion_operator): ... this. (lookup_fnfields_slot_nolazy): Find conv-ops by name. (lookup_all_conversions): Delete. * pt.c (check_explicit_specialization): Find conv-ops by name. * search.c (lookup_conversions_r): Likewise. 2017-08-24 Nathan Sidwell Conversion operators kept on single overload set * class.c (add_method): Keep all conv-ops on one slot. * name-lookup.c (lookup_conversion_operator): Pull the desired conv op out of overload set. * search.c (lookup_conversions_r): Lose template/non-template distinction. (lookup_conversions): Likewise. 2017-08-23 Nathan Sidwell * cp-tree.h (lookup_field_1, lookup_fnfields_slot, lookup_fnfields_slot_nolazy, lookup_all_conversions): Move declatations to ... * name-lookup.h (lookup_field_1, lookup_fnfields_slot, lookup_fnfields_slot_nolazy, lookup_all_conversions): ... here. * search.c (lookup_conversion_operator, lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot, lookup_all_conversions): Move to ... * name-lookup.c (lookup_conversion_operator, lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot, lookup_all_conversions): ... here. * semantics.c (finish_member_declaration): Move USING_DECL check earlier. Always set C++ linkage. Commonize TYPE_FIELD and template decl list insertion. * cp-tree.h (maybe_version_functions): Declare. * decl.c (decls_match): Break function versioning check to separate function. Call it. (maybe_version_functions): Broken out of decls_match. * class.c (add_method): Use maybe_version_functions. * cp-tree.h (print_search_statistics, reinit_search_statistics): Don't declare. * search.c (n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1, n_calls_lookup_fnfields, n_calls_lookup_fnfields_1, n_calls_get_base_type, n_outer_fields_searched, n_contexts_saved): Delete. (lookup_field_1, lookup_member, lookup_fnfields_slot_nolazy): Remove stat gathering. (print_search_statistics, reinit_search_statistics): Delete. * tree.c (cxx_print_statistics): Don't print search stats. 2017-08-21 Nathan Sidwell * search.c (lookup_field_r): Remove obsolete code for type-named field in PoD. * search.c (lookup_field_1): Assert TYPE is a class and VFIELD isn't special. (lookup_field_fuzzy_info::fuzzy_lookup_fnfields): Delete. (lookup_field_fuzzy_r): Adjust. 2017-08-21 David Malcolm * call.c (build_over_call): Pass NULL for new parameter to check_function_arguments. * typeck.c (cp_build_function_call_vec): Likewise. 2017-08-21 Nathan Sidwell PR c++/81899 * pt.c (instantiate_class_template_1): BOUND_TEMPLATE_TEMPLATE_PARM is never friend-injected. 2017-08-18 David Malcolm PR c++/81514 * name-lookup.c (maybe_suggest_missing_header): Convert return type from void to bool; return true iff a suggestion was offered. (suggest_alternative_in_explicit_scope): Move call to maybe_suggest_missing_header to before use of best_match, and return true if the former offers a suggestion. 2017-08-18 H.J. Lu PR c/53037 * decl.c (duplicate_decls): Also merge DECL_WARN_IF_NOT_ALIGN. * decl2.c (grokbitfield): Don't allow bit-field with warn_if_not_aligned type. 2017-08-17 Nathan Sidwell * cp-tree.def (TEMPLATE_TEMPLATE_PARM): Remove stale comment. * cp-tree.h (ENUM_TEMPLATE_INFO): Delete. (TYPE_TEMPLATE_INFO): Simplify. (SET_TYPE_TEMPLATE_INFO): Simplify. * lex.c (maybe_add_lang_type_raw): BOUND_TEMPLATE_TEMPLATE_PARMs don't need lang_type. (cxx_make_type): Use maybe_add_lang_type_raw return value. * mangle.c (CLASSTYPE_TEMPLATE_ID_P): Don't rely on TYPE_LANG_SPECIFIC. * cp-tree.h (struct lang_type): Remove template_info field. (CLASSTYPE_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise. 2017-08-14 Martin Sebor PR c/81117 * error.c (cp_printer): Handle 'G'. 2017-08-11 Martin Liska * decl2.c (get_tls_init_fn): Replace ASM_OUTPUT_DEF with TARGET_SUPPORTS_ALIASES. (handle_tls_init): Likewise. (note_mangling_alias): Likewise. Remove ATTRIBUTE_UNUSED for both arguments. * optimize.c (can_alias_cdtor): Likewise. 2017-08-11 Jason Merrill PR c++/81671 - nullptr_t template parameter * pt.c (convert_nontype_argument): Fix nullptr_t check. 2017-08-10 Jason Merrill PR c++/81359 - Unparsed NSDMI error from SFINAE context. * method.c (synthesized_method_walk): Don't diagnose lack of operator delete. PR c++/80452 - Core 1579, implicit move semantics on return/throw * cp-tree.h (LOOKUP_PREFER_RVALUE): Now means that we've already tentatively changed the lvalue to an rvalue. * call.c (reference_binding): Remove LOOKUP_PREFER_RVALUE handling. (build_over_call): If LOOKUP_PREFER_RVALUE, check that the first parameter is an rvalue reference. * except.c (build_throw): Do maybe-rvalue overload resolution twice. * typeck.c (check_return_expr): Likewise. 2017-08-10 David Malcolm * parser.c (cp_parser_error): Update for new param to c_parse_error. (class token_pair): New class. (struct matching_paren_traits): New struct. (matching_parens): New typedef. (struct matching_brace_traits): New struct. (matching_braces): New typedef. (cp_parser_statement_expr): Convert explicit parsing of CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use of class matching_parens, so that the pertinent open parenthesis is highlighted when there are problems locating the close parenthesis. (cp_parser_primary_expression): Likewise. (cp_parser_compound_literal_p): Remove consumption of opening paren. (cp_parser_postfix_expression): Convert explicit parsing of CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use matching parens, as above. Use it to consume the opening paren previously consumed by cp_parser_compound_literal_p. (cp_parser_parenthesized_expression_list): Likewise. (cp_parser_unary_expression): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_cast_expression): Likewise. (cp_parser_builtin_offsetof): Likewise. (cp_parser_trait_expr): Likewise. (cp_parser_lambda_declarator_opt): Likewise. (cp_parser_lambda_body): Likewise, for matching_braces. (cp_parser_compound_statement): Likewise. (cp_parser_selection_statement): Likewise, for matching_parens. (cp_parser_iteration_statement): Likewise. (cp_parser_already_scoped_statement): Likewise, for matching_braces. (cp_parser_linkage_specification): Likewise. (cp_parser_static_assert): Likewise, for matching_parens. (cp_parser_decltype): Likewise. (cp_parser_operator): Likewise. (cp_parser_enum_specifier): Likewise. (cp_parser_namespace_definition): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_braced_list): Likewise. (cp_parser_class_specifier_1): Likewise, for matching_braces. (cp_parser_constant_initializer): Likewise. (cp_parser_noexcept_specification_opt): Likewise, for matching_parens. (cp_parser_exception_specification_opt): Likewise. (cp_parser_handler): Likewise. (cp_parser_asm_specification_opt): Likewise. (cp_parser_asm_operand_list): Likewise. (cp_parser_gnu_attributes_opt): Likewise. (cp_parser_std_attribute_spec): Likewise. (cp_parser_requirement_parameter_list): Likewise. (cp_parser_requirement_body): Likewise, for matching_braces. (cp_parser_compound_requirement): Likewise. (cp_parser_template_introduction): Likewise. (cp_parser_sizeof_pack): Likewise, for matching_parens. (cp_parser_sizeof_operand): Likewise; use it to consume the opening paren previously consumed by cp_parser_compound_literal_p. (get_matching_symbol): New function. (cp_parser_required_error): Add param "matching_location". Remove calls to cp_parser_error, instead setting a non-NULL gmsgid, and handling it if set by calling c_parse_error, potentially with a secondary location if matching_location was set. (cp_parser_require): Add param "matching_location", with a default value of UNKNOWN_LOCATION. (cp_parser_require_keyword): Update for new param of cp_parser_required_error. (cp_parser_objc_encode_expression): Update to class matching_parens as above. (cp_parser_objc_defs_expression): Likewise. (cp_parser_objc_protocol_expression): Likewise. (cp_parser_objc_selector_expression): Likewise. (cp_parser_objc_typename): Likewise. (cp_parser_objc_superclass_or_category): Likewise. (cp_parser_objc_try_catch_finally_statement): Likewise. (cp_parser_objc_synchronized_statement): Likewise. (cp_parser_objc_at_property_declaration): Likewise. (cp_parser_oacc_single_int_clause): Likewise. (cp_parser_oacc_shape_clause): Likewise. (cp_parser_omp_clause_collapse): Likewise. (cp_parser_omp_clause_default): Likewise. (cp_parser_omp_clause_final): Likewise. (cp_parser_omp_clause_if): Likewise. (cp_parser_omp_clause_num_threads): Likewise. (cp_parser_omp_clause_num_tasks): Likewise. (cp_parser_omp_clause_grainsize): Likewise. (cp_parser_omp_clause_priority): Likewise. (cp_parser_omp_clause_hint): Likewise. (cp_parser_omp_clause_defaultmap): Likewise. (cp_parser_omp_clause_ordered): Likewise. (cp_parser_omp_clause_schedule): Likewise. (cp_parser_omp_clause_num_teams): Likewise. (cp_parser_omp_clause_thread_limit): Likewise. (cp_parser_omp_clause_aligned): Likewise. (cp_parser_omp_clause_linear): Likewise. (cp_parser_omp_clause_safelen): Likewise. (cp_parser_omp_clause_simdlen): Likewise. (cp_parser_omp_clause_depend): Likewise. (cp_parser_omp_clause_device): Likewise. (cp_parser_omp_clause_dist_schedule): Likewise. (cp_parser_oacc_clause_async): Likewise. (cp_parser_omp_critical): Likewise. (cp_parser_omp_for_loop): Likewise. (cp_parser_omp_sections_scope): Likewise. (cp_parser_omp_declare_reduction_exprs): Likewise. Update for new param to cp_parser_required_error. (cp_parser_oacc_routine): Likewise. (cp_parser_transaction_expression): Likewise. (cp_parser_cilk_simd_vectorlength): Likewise. 2017-08-09 Jason Merrill PR c++/81525 - wrong constant value with generic lambda * pt.c (tsubst_decl) [VAR_DECL]: Avoid clobbering auto. (tsubst_copy) [VAR_DECL]: Handle auto. PR c++/81359 - Unparsed NSDMI error from SFINAE context. * init.c (get_nsdmi): Add complain parm. * typeck2.c (digest_nsdmi_init): Add complain parm. (process_init_constructor_record): Pass complain to get_nsdmi. * pt.c (maybe_instantiate_noexcept): Add complain parm, return bool. * method.c (get_defaulted_eh_spec): Add complain parm. Pass it into synthesized_method_walk. (synthesized_method_walk): Adjust. (walk_field_subobs): Pass complain to get_nsdmi. (defaulted_late_check): Skip other checks if deleted. * decl2.c (mark_used): Pass complain to maybe_instantiate_noexcept. * call.c (build_aggr_conv): Pass complain to get_nsdmi. * parser.c (defarg_location): New. * error.c (location_of): Use it. 2017-08-09 Marek Polacek * parser.c (cp_parser_perform_range_for_lookup): Use false instead of 0. * typeck.c (build_binary_op): Change the type of a parameter to bool. (cp_truthvalue_conversion): Use true instead of 1. 2017-08-08 Marek Polacek PR c++/81607 * cp-gimplify.c (cp_fold): If folding exposed a branch of a COND_EXPR, convert it to the original type of the COND_EXPR, if they differ. 2017-08-08 Martin Liska * call.c: Include header files. * cp-gimplify.c: Likewise. * cp-ubsan.c: Likewise. * cvt.c: Likewise. * init.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. 2017-08-07 Martin Liska * parser.c (cp_parser_gnu_attribute_list): Canonicalize name of an attribute. (cp_parser_std_attribute): Likewise. * tree.c: Add new include. 2017-08-04 Paolo Carlini PR c++/79790 * pt.c (do_class_deduction): Handle the case of no viable implicit deduction guides; simplify the code generating implicit deduction guides. 2017-08-03 Paolo Carlini PR c++/71440 * typeck.c (build_x_unary_op): Avoid pretty-printing constructor / destructor as expressions. 2017-08-02 Jakub Jelinek PR c++/81640 * call.c (build_user_type_conversion_1): Only call lookup_fnfields_slot if totype is CLASS_TYPE_P. 2017-07-31 Jason Merrill * decl.c (declare_global_var): Set DECL_CONTEXT. 2017-07-31 Jan Hubicka Martin Liska * pt.c (tsubst_copy): Copy PREDICT_EXPR. * semantics.c (finish_goto_stmt): Build gimple predict stament. * constexpr.c (potential_constant_expression_1): Handle PREDICT_EXPR. 2017-07-31 Martin Liska PR sanitize/81530 * cp-gimplify.c (cp_genericize): Guard condition with flag_sanitize_p also with current_function_decl non-null equality. * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise. * decl.c (compute_array_index_type): Likewise. * init.c (finish_length_check): Likewise. * typeck.c (cp_build_binary_op): Likewise. 2017-07-29 Jakub Jelinek * cp-objcp-common.c (cp_decl_dwarf_attribute): Handle DW_AT_export_symbols. * name-lookup.c (emit_debug_info_using_namespace): Add IMPLICIT argument, pass it through to the debug hook. (finish_namespace_using_directive): Adjust emit_debug_info_using_namespace caller. (push_namespace): Likewise. Call it after setting DECL_NAMESPACE_INLINE_P. (cp_emit_debug_info_for_using): Pass false as new argument to the imported_module_or_decl debug hook. 2017-07-28 Trevor Saunders * lex.c (copy_decl): Adjust. (copy_type): Likewise. 2017-07-26 Paolo Carlini PR c++/71570 * lambda.c (add_capture): Early return if we cannot capture by reference. 2017-07-26 Jason Merrill P0702R1 - List deduction of vector. * pt.c (do_class_deduction): Special-case deduction from a single element of related type. 2017-07-26 Leonid Koppel PR c++/67054 - Inherited ctor with non-default-constructible members * method.c (walk_field_subobs) Consider member initializers (NSDMIs) when deducing an inheriting constructor. 2017-07-21 Nathan Sidwell * search.c (lookup_conversion_operator): Return overloads. (lookup_fnfields_idx_nolazy): Absorb into ... (lookup_fnfields_slot_nolaxy): ... here. (lookup_fnfields_1): Absorb into ... (lookup_fnfields_slot): ... here. Remove special CDtor METHOD_VEC slots. * cp-tree.h (CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT): Delete. (CLASSTYPE_CONSTRUCTORS): Use lookup_fnfields_slot_nolazy. (CLASSTYPE_DESTRUCTOR): Likewise. * class (add_method): Don't use special cdtor slots. * search.c (lookup_fnfields_idx_nolazy): Likewise. (look_for_overrides_here): Use lookup_fnfields_slot. * semantics (classtype_has_nothrow_assign_or_copy_p): Likewise. * call.c (add_candidates): Move decls to initialization. Don't use !!. 2017-07-20 Nathan Sidwell Remove TYPE_METHODS. * class.c (maybe_warn_about_overly_private_class, finish_struct_methods, one_inheriting_sig, count_fields, add_fields_to_record_type, check_field_decls, check_methods, clone_function_decl, set_method_tm_attributes, finalize_literal_type_property, check_bases_and_members, create_vtable_ptr, determine_key_method, unreverse_member_declarations, finish_struct, add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS. * decl.c (fixup_anonymous_aggr): Likewise. * decl2.c (reset_type_linkage_2): Likewise. * method.c (after_nsdmi_defaulted_late_checks, lazily_declare_fn): Likewise. * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise. * pt.c (instantiate_class_template_1, tsubst_expr, do_type_instantiation, instantiate_pending_templates): Likewise. * search.c (lookup_field_1): Likewise. * semantics.c (finish_member_declaration, finish_omp_declare_simd_methods): Likewise. 2017-07-19 Nathan Sidwell * class.c (add_implicitly_declared_members): Use classtype_has_move_assign_or_move_ctor_p. (classtype_has_move_assign_or_move_ctor, classtype_has_user_move_assign_or_move_ctor_p): Merge into ... (classtype_has_move_assign_or_move_ctor_p): ... this new function. * cp-tree.h (classtype_has_user_move_assign_or_move_ctor_p): Replace with ... (classtype_has_move_assign_or_move_ctor_p): ... this. * method.c (maybe_explain_implicit_delete, lazily_declare_fn): Adjust. * tree.c (type_has_nontrivial_copy_init): Adjust. * cp-tree.h (PACK_EXPANSION_PARAMETER_PACKS, PACK_EXPANSION_EXTRA_ARGS): Use TYPE_{MIN,MAX}_VALUE_RAW. 2017-07-18 Nathan Sidwell * cp-array-notation.c (build_array_notation_ref): Use TYPE_{MIN,MAX}_VALUE. * class.c (classtype_has_move_assign_or_move_ctor): Declare. (add_implicitly_declared_members): Use it. (type_has_move_constructor, type_has_move_assign): Merge into ... (classtype_has_move_assign_or_move_ctor): ... this new function. * cp-tree.h (type_has_move_constructor, type_has_move_assign): Delete. 2017-07-17 Volker Reichelt * parser.c (cp_parser_decl_specifier_seq): Add fix-it hints for friend outside class and obsolete auto as storage-class-specifier. 2017-07-17 Nathan Sidwell * class.c (maybe_warn_about_overly_private_class): Ignore public copy ctors. * class.c (type_has_user_declared_move_constructor, type_has_user_declared_move_assign): Combine into ... (classtype_has_user_move_assign_or_move_ctor_p): ... this new function. * cp-tree.h (type_has_user_declared_move_constructor, type_has_user_declared_move_assign): Combine into ... (classtype_has_user_move_assign_or_move_ctor_p): ... this. Declare. * method.c (maybe_explain_implicit_delete): Use it. (lazily_declare_fn): Use it. * tree.c (type_has_nontrivial_copy_init): Use it. * semantics.c (classtype_has_nothrow_assign_or_copy_p): Clarify semantics, simplify implementation. 2017-07-16 Volker Reichelt * parser.c (cp_parser_cast_expression): Use %q#T instead of %qT in old-style cast diagnostic. * typeck.c (maybe_warn_about_useless_cast): Use %q#T instead of %qT in useless cast diagnostic. * error.c (type_to_string): Remove enum special handling. 2017-07-14 David Malcolm * name-lookup.c (get_std_name_hint): Add '<' and '>' around the header names. (maybe_suggest_missing_header): Update for addition of '<' and '>' to above. Provide a fix-it hint. * pt.c: Include "gcc-rich-location.h" (listify): Attempt to add fix-it hint for missing #include . * rtti.c: Include "gcc-rich-location.h". (typeid_ok_p): Attempt to add fix-it hint for missing #include . 2017-07-12 Jason Merrill P0512R0 - Deduction from an initializer list. * pt.c (do_class_deduction): Do list deduction in two phases. 2017-07-12 Nathan Sidwell * cp-tree.h (DECL_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_CONSTRUCTOR, DECL_DESTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRCTOR): Look at identifier flags. * decl.c (grokfndecl): Set DECL_CXX_CONSTRUCTOR and DECL_CXX_DESTRUCTOR explicitly. * decl2.c (grokclassfn): Likewise. * friend.c (do_friend): Likewise. * method.c (make_thunk, make_alias_for, implicitly_declare_fn): Likewise. 2017-07-11 Jason Merrill Core DR 393 * decl.c (grokparms): Downgrade error about array of unknown bound to pedwarn and disable it for C++17. 2017-07-11 Nathan Sidwell * decl2.c (reset_type_linkage_2): Dont't change ctor name. 2017-07-10 Martin Sebor * cp-tree.h (cp_operator_id, cp_assignment_operator_id): Document. 2017-07-06 Jason Merrill PR c++/81204 - parse error with dependent template-name * parser.c (cp_parser_lookup_name): Revert previous change. 2017-07-06 David Malcolm * cp-lang.c (LANG_HOOKS_RUN_LANG_SELFTESTS): Define as selftest::run_cp_tests. (selftest::run_cp_tests): New function. * cp-tree.h (selftest::run_cp_tests): New decl. 2017-07-04 Jakub Jelinek * parser.c (cp_parser_decomposition_declaration): Replace decomposition declaration with structured binding in diagnostics. * decl.c (cp_finish_decomp): Likewise. (grokdeclarator): Likewise. PR c++/81258 * parser.c (cp_parser_decomposition_declaration): Diagnose invalid forms of structured binding initializers. 2017-07-03 Paolo Carlini PR c++/65775 * decl.c (grokdeclarator): Move checks on function return type after the splice_late_return_type call; if declspecs->locations[ds_type_spec] is UNKNOWN_LOCATION fall back to input_location. 2017-07-03 David Malcolm * parser.c (enum required_token): Fix spelling of RT_INTERATION to RT_ITERATION. (cp_parser_iteration_statement): Likewise. (cp_parser_required_error): Likewise. 2017-06-30 Jason Merrill PR c++/81257 - ICE with invalid ::template. PR c++/54769 - wrong lookup of dependent template-name. * parser.c (cp_parser_template_name): Revert part of last change. 2017-06-30 Nathan Sidwell * config-lang.in (gtfiles): Add cp/lex.c. * cp-tree.h (mangle_convop_name_for_type): Rename ... (make_conv_op_name): ... here. Move to lex. * lambda.c (maybe_add_lambda_conv_op): Update. * parser.c (cp_parser_conversion_function_id): Update. * pt.c (tsubst_decl, tsubst_baselink, tsubst_copy, tsubst_copy_and_build): Update. * semantics.c (apply_deduced_return_type): Update. * mangle.c (conv_type_hasher, conv_type_names, mangle_conv_op_name_for_type): Move to ... * lex.c (conv_type_hasher, conv_type_names, make_convop_name): ... here. Rename. 2017-06-30 David Malcolm PR c++/80014 * parser.c (cp_parser_postfix_expression): Construct a location for typeid expressions. 2017-06-30 Nathan Sidwell * cp-tree.h (lookup_fnfields_1, class_method_index_for_fn): Don't declare. (lookup_all_conversions): Declare. * class.c (get_basefndecls): Use lookup_fnfields_slot. * decl.c (register_dtor_fn): Use lookup_fnfields_slot. * decl2.c (check_class_fn): Use lookup_fnfields_slot. Rework diagnostics. * pt.c (retrieve_specialization): Use lookup_fnfields_slot. (check_explicit_specialization): Use lookup_fnfields_slot_nolazy, lookup_all_conversions. * search.c (lookup_fnfields_1): Make static. (lookup_all_conversions): New. (class_method_index_for_fn): Delete. * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use lookup_fnfields_slot. * call.c (build_new_method_call_1): Use constructo_name to get ctor name. Move argument processing earlier to merge cdtor handling blocks. * decl.c (grokfndecl): Cdtors have special names. * method.c (implicitly_declare_fn): Likewise. Simplify flag setting. * pt.c (check_explicit_specialization): Cdtor name is already special. * search.c (class_method_index_for_fn): Likewise. PR c++/81229 * name-lookup.c (do_pushdecl): Reset IDENTIFIER_TYPE when finding a matching TYPE_DECL. 2017-06-29 Paolo Carlini * class.c (add_method): Change pair of errors to error + inform. (handle_using_decl): Likewise. 2017-06-29 Jason Merrill * constexpr.c, error.c, tree.c: Remove WITH_CLEANUP_EXPR handling. PR c++/81180 - ICE with C++17 deduction of member class template. * pt.c (build_deduction_guide): Correct member template handling. PR c++/81188 - matching decltype of member function call. * tree.c (cp_tree_equal): Remove COMPONENT_REF special case. 2017-06-29 Nathan Sidwell PR c++/81247 * parser.c (cp_parser_namespace_definition): Immediately close the namespace if there's no open-brace. * name-lookup.c (do_pushdecl): Reset OLD when pushing into new namespace. 2017-06-29 Jason Merrill PR c++/81164 - ICE with invalid inherited constructor. * search.c (binfo_direct_p): New. * name-lookup.c (do_class_using_decl): Use it. 2017-06-29 Nathan Sidwell * cp-tree.h (THIS_NAME, IN_CHARGE_NAME, VTBL_PTR_TYPE, VTABLE_DELTA_NAME, VTABLE_PFN_NAME): Delete. * decl.c (initialize_predefined_identifiers): Name cdtor special names consistently. Use literals for above deleted defines. (cxx_init_decl_processing): Use literal for vtbl_ptr_type name, * lex.c (maybe_add_lang_type_raw): Exit early, rather than use a flag. * call.c (check_dtor_name): Use constructor_name for enums too. (build_new_method_call_1): Use constructor_name for cdtors and show ~ for dtor. * class.c (build_self_reference): Use TYPE_NAME to get name of self reference. * name-lookup (constructor_name): Use DECL_NAME directly. (constructor_name_p): Reimplement. (push_class_level_binding_1): Use TYPE_NAME directly. * class.c (finish_struct): Use OVL_P. (get_vfield_name): Measure constructor_name length. * cp-tree.h (SET_CLASS_TYPE_P): Add RECORD_OR_UNION_CHECK. (NON_UNION_CLASS_TYPE_P): Check RECORD_TYPE up front. * cxx-pretty-print.c (is_destructor_name): Delete. (pp_cxx_unqualified_id): Remove bogus destructor name checking. * decl.c (grokfndecl): Move cheap checks first when looking for implicit extern cness. * parser.c (cp_parser_direct_declarator): Reorder if to avoid indentation. Remove unnecessary assignment of constructor name. Whitespace cleanups. * call.c (name_as_c_string): Move CONST_CAST to return. (build_new_method_call_1): Remove unneeded bracing. * class.c (include_empty_classes): Unbreak line. * constraint.cc (tsubst_check_constraint): Add space. * cp-tree.h (lang_decl_ns): Add comment. (PTRMEM_CST_MEMBER): Break line. * decl.c (grokfndecl): Add blank lines. Unbreak some others. (grokdeclarator): Remove lines, move declaration to first use. * decl2.c (decl_needed_p): Fix indentation. (c_parse_final_cleanups): Remove blank line. * method.c (implicitly_declare_fn): Move declaration to first use. * search.c (current_scope): Add blank lines. 2017-06-28 Jason Merrill PR c++/72764 - ICE with invalid template typename. * decl.c (build_typename_type): No longer static. * tree.c (strip_typedefs): Use it instead of make_typename_type. PR c++/69300 - ICE with self-referential noexcept * pt.c (maybe_instantiate_noexcept): Check for recursion. PR c++/61022 - error with variadic template template parm * pt.c (convert_template_argument): Keep the TYPE_PACK_EXPANSION. PR c++/72801 - ICE with variadic partial specialization * pt.c (unify_pack_expansion): Use PACK_EXPANSION_EXTRA_ARGS. PR c++/55639 - partial specialization with ::template * parser.c (cp_parser_class_head): Handle ::template. PR c++/45976 - error with ::template in declarator. * pt.c (resolve_typename_type): Fix TEMPLATE_ID_EXPR handling. PR c++/54769 - wrong lookup of dependent template-name. * parser.c (cp_parser_template_name): Handle dependent object type. (cp_parser_nested_name_specifier_opt): Make template_keyword_p a parameter. (cp_parser_id_expression): Pass it. (cp_parser_diagnose_invalid_type_name): Handle TEMPLATE_ID_EXPR. * parser.c (cp_parser_template_id): Use the range location on the TEMPLATE_ID_EXPR. PR c++/81204 - parse error with dependent template-name * parser.c (cp_parser_lookup_name): Disqualify function templates after lookup. 2017-06-27 Nathan Sidwell * pt.c (tsubst_decl ): Move var decls to initialization point. Don't unnecessarily check for ctor name. * cp-tree.h (CLASSTYPE_DESTRUCTORS): Rename to ... (CLASSTYPE_DESTRUCTOR): ... this. * class.c (accessible_nvdtor_p, maybe_warn_about_overly_private_class, add_implicitly_declared_members, clone_constructors_and_destructors, type_has_virtual_destructor): Adjust for CLASSTYPE_DESTRUCTOR. (deduce_noexcept_on_destructors): Absorb into ... (check_bases_and_members): ... here. * except.c (dtor_nothrow): Adjust for CLASSTYPE_DESTRUCTOR. * init.c (build_delete): Likewise. * parser.c (cp_parser_lookup_name): Likewise. * pt.c (check_explicit_specialization): Likewise. * rtti.c (emit_support_tinfos): Likewise. * search.c (lookup_fnfields_idx_nolazy): Likewise. Kill IDENTIFIER_TEMPLATE. * cp-tree.h (lang_identifier): Remove class_template_info field. (IDENTIFIER_TEMPLATE): Delete. * name-lookup.c (constructor_name_full): Subsume into ... (constructor_name): ... here. Don't check IDENTIFIER_TEMPLATE. (constructor_name_p): Likewise. * mangle.c (write_source_name): Likewise. * ptree.c (cxx_print_identifier): Likewise. 2017-06-27 Marek Polacek PR bootstrap/81216 * parser.c (cp_parser_already_scoped_statement): Initialize LOC_AFTER_LABELS. 2017-06-26 Jason Merrill PR c++/81215 - deduction failure with variadic TTP. * pt.c (unify_bound_ttp_args): Restore old logic for C++14 and down. 2017-06-26 Martin Sebor PR c++/81169 * call.c (maybe_warn_class_memaccess): Preserve explicit conversions to detect casting away cv-qualifiers. 2017-06-26 Nathan Sidwell * cp-tree.h (lang_decl_fn): Remove assignment_operator_p field. (DECL_COMPLETE_CONSTRUCTOR_P): Directly compare identifier. (DECL_BASE_CONSTRUCTOR_P, DECL_COMPLETE_DESTRUCTOR_P, DECL_BASE_DESTRUCTOR_P, DECL_DELETING_DESTRUCTOR_P): Likewise. (DECL_ASSIGNMENT_OPERATOR_P): Use IDENTIFIER_ASSIGN_OP_P. * decl.c (grok_op_properties): Adjust identifier checking. * init.c (expand_default_init): Adjust identifier descision. * method.c (implicitly_declare_fn): Don't use DECL_ASSIGNMENT_OPERATOR_P. * search.c (lookup_fnfields_1): Use IDENTIFIER_CTOR_P, IDENTIFIER_DTOR_P. * call.c (in_charge_arg_for_name): Reimplement. (build_special_member_call): Use IDENTIFIER_CDTOR_P, IDENTIFIER_DTOR_P. 2017-06-26 Marek Polacek PR c/80116 * parser.c (cp_parser_statement): Add a default argument. Save the location of the expression-statement after labels have been parsed. (cp_parser_implicitly_scoped_statement): Set the location of the body of the conditional after parsing all the labels. Call warn_for_multistatement_macros. (cp_parser_already_scoped_statement): Likewise. 2017-06-24 Paolo Carlini PR c++/62315 * parser.c (cp_parser_diagnose_invalid_type_name): Don't print 'typename' in error messages about missing 'typename'. 2017-06-23 Jason Merrill PR c++/79056 - C++17 ICE with invalid template syntax. * parser.c (cp_parser_simple_type_specifier): Don't assume that type is a TYPE_DECL. (cp_parser_check_for_invalid_template_id): Handle TYPE_DECL. * pt.c (template_placeholder_p): New. * cp-tree.h: Declare it. 2017-06-23 Marc Glisse * decl.c (duplicate_decls): Use builtin_structptr_types. 2017-06-22 Nathan Sidwell Reorder IDENTIFIER flags gcc/cp/ * cp-tree.h (enum cp_identifier_kind): New. (IDENTIFIER_KIND_BIT_0, IDENTIFIER_KIND_BIT_1, IDENTIFIER_KIND_BIT_2): New. (IDENTIFIER_MARKED): Move to TREE_LANG_FLAG_4. (IDENTIFIER_VIRTUAL_P, IDENTIFIER_REPO_CHOSEN): Add IDENTIFIER_CHECK. (C_IS_RESERVED_WORD): Replace with ... (IDENTIFIER_KEYWORD_P): ... this. (IDENTIFIER_CTOR_OR_DTOR_P): Replace with ... (IDENTIFIER_CDTOR_P): ... this. (IDENTIFIER_CTOR_P, IDENTIFIER_DTOR_P): New. (IDENTIFIER_OPNAME_P): Replace with ... (IDENTIFIER_ANY_OP_P): ... this. (IDENTIFIER_ASSIGN_OP_P): New. (IDENTIFIER_TYPENAME_P): Replace with ... (IDENTIFIER_CONV_OP_P): ... this. (NEW_DELETE_OPNAME_P): Replace with ... (IDENTIFIER_NEWDEL_OP_P): ... this. (DECL_CONV_FN_P, DECL_OVERLOADED_OPERATOR_P): Adjust. (get_identifier_kind_name, set_identifier_kind): Declare. * lex.c (get_identifier_kind_name, set_identifier_kind): New. (init_operators): Adjust to avoid keywords, use set_identifier_kind. Copy TYPE_EXPR slot. (init_reswords): Call set_identifier_kind. (unqualified_name_lookup_error): Adjust. * operators.def (TYPE_EXPR): Remove. * decl.c (struct predefined_identifier): Move into ... (initialize_predefined_identifiers): ... here. Call set_identifier_kind. (grokfndecl, check_var_type, grokdeclarator): Adjust. (grok_op_properties): Use IDENTIFIER_ANY_ASSIGN_OP to halve search space. Adjust. * call.c (name_as_c_string): Adjust. (build_new_method_call_1): Likewise. * cp-cilkplus.c (is_conversion_operator_function_decl_p): Likewise. * cxx-pretty-print.c (pp_cxx_unqualified_id): Adjust. * dump.c (cp_dump_tree): Adjust. * error.c (dump_decl_name): Adjust. * mangle.c (write_unqualified_id, write_member_name, write_expression): Adjust. (mangle_conv_op_name_for_type): Use set_identifier_kind. * name-lookup.c (do_class_using_decl): Adjust. (lookup_name_fuzzy, lookup_name_real_1): Likewise. * parser.c (cp_lexer_get_preprocessor_token, cp_parser_direct_declarator): Likewise. * pt.c (push_template_decl_real, tsubst_decl, tsubst_baselink, tsubst_copy, tsubst_copy_and_build): Adjust. * ptree.c (cxx_print_identifier): Print identifier kind. * search.c (lookup_field_r, lookup_member, lookup_fnfields_idx_nolazy): Adjust. * semantics.c (finish_id_expression): Adjust.. * typeck.c (cp_build_addr_expr_1): Adjust. 2017-06-21 Jakub Jelinek PR c++/81154 * semantics.c (handle_omp_array_sections_1, finish_omp_clauses): Complain about t not being a variable if t is OVERLOAD even when processing_template_decl. 2017-06-21 David Malcolm * parser.c (get_cast_suggestion): New function. (maybe_add_cast_fixit): New function. (cp_parser_cast_expression): Capture the location of the closing parenthesis. Call maybe_add_cast_fixit when emitting warnings about old-style casts. 2017-06-20 Jason Merrill PR c++/80972 - C++17 ICE with attribute packed. * call.c (build_over_call): Allow a TARGET_EXPR from reference binding. 2017-06-20 Nathan Sidwell * cp-tree.h (CPTI_NELTS_IDENTIFIER): Delete. (nelts_identifier): Delete. * decl.c (initialize_predefined_identifiers): Remove nelts. PR c++/67074 - namespace aliases * decl.c (duplicate_decls): Don't error here on mismatched namespace alias. * name-lookup.c (name_lookup::add_value): Matching namespaces are not ambiguous. (diagnose_name_conflict): Namespaces are never redeclarations. (update_binding): An alias can match a real namespace. 2017-06-19 Jason Merrill PR c++/80562 - ICE with constexpr if. * semantics.c (finish_if_stmt_cond): Call instantiate_non_dependent_expr. PR c++/80829 - ICE with constexpr copy of base subobject. * constexpr.c (clear_no_implicit_zero): New. (cxx_eval_call_expression): Call it. 2017-06-19 Nathan Sidwell PR c++/81124 PR c++/79766 * name-lookup.c (set_decl_namespace): Don't follow using directives and ignore using decls. Only check overly-explicit scope after discovering decl. 2017-06-19 Jason Merrill PR c++/81073 - constexpr and static var in statement-expression. * typeck2.c (store_init_value): Always call require_potential_constant_expression. * pt.c (convert_nontype_argument): Likewise. * constexpr.c (potential_constant_expression_1): Adjust message. Use decl_maybe_constant_var_p instead of decl_constant_var_p. * decl2.c (decl_maybe_constant_var_p): Consider initializer. 2017-06-19 Nathan Sidwell * pt.c (coerce_template_parms): Fix indentation. (tsubst_decl): Remove repeated SET_DECL_RTL. Move VAR_P handling in to single block. PR c++/81119 * name-lookup.c (update_binding): Only warn about constructors hidden by functions. 2017-06-17 Jason Merrill PR c++/60063 - -Wunused-local-typedefs and templates. * decl2.c (is_late_template_attribute): Return false for "used". PR c++/70844 - -Wuseless-cast and inheriting constructor. * method.c (forward_parm): Suppress warn_useless_cast. 2017-06-16 Jason Merrill PR c++/81045 - Wrong type-dependence with auto return type. * pt.c (type_dependent_expression_p): An undeduced auto outside the template isn't dependent. * call.c (build_over_call): Instantiate undeduced auto even in a template. PR c++/80465 - ICE with generic lambda with noexcept-specifier. * lambda.c (maybe_add_lambda_conv_op): Keep processing_template_decl set longer for a generic lambda. PR c++/80614 - Wrong mangling for C++17 noexcept type * mangle.c (write_type): Put the eh spec back on the function type. PR c++/81102 - Wrong error with partial specialization. * pt.c (unify) [TEMPLATE_PARM_INDEX]: Strip reference when comparing types. Do type deduction later. PR c++/81074 - ICE with partial specialization of member template. PR c++/71747 * pt.c (get_partial_spec_bindings): Only coerce innermost args. PR c++/80831 - ICE with -fsyntax-only. * decl2.c (c_parse_final_cleanups): Use cgraph_node::get_create. PR c++/80639 - ICE with invalid PMF initialization. PR c++/80043 - ICE with -fpermissive * typeck.c (convert_for_assignment): Recurse when instantiate_type returns without an error. 2017-06-16 Nathan Sidwell * pt.c (tsubst_baselink): Fix & clarify formatting. * cp-tree.h (build_this_parm, cp_build_parm_decl, build_artificial_parm): Add FN parm. * decl.c (start_cleanup_fn): Adjust. (build_this_parm): Add FN parm, pass it through. (grokfndecl): Adjust parm building. * decl2.c (cp_build_parm_decl): Add FN parm, set context. (build_artificial_parm): Add FN parm, pass through. (maybe_retrofit_in_chrg): Adjust parm building. (start_static_storage_duration_function): Likwise. * lambda.c (maybe_aadd_lambda_conv_op): Likewise. * method.c (implicitly_declare_fn): Likewise. * parser.c (inject_this_parameter): Likewise. Symbol tables are insert only. * cp-tree.h (default_hash_traits ): Don't derive from pointer_hash. Make undeletable. * class.c (resort_type_method_vec): Avoid potential unsigned overflow. Don't defer noexcept_deferred_spec. * cp-tree.h (unevaluated_noexcept_spec): Don't declare. * decl.c (cxx_init_decl_processing): Initialize noexcept_deferred_spec. * except.c (unevaluated_noexcept_spec): Delete. * class.c (deduce_noexcept_on_destructor): Use noexcept_deferred_spec directly. * method.c (implicitly_declare_fn): Likewise. Make keyed_classes a vector. * cp-tree.h (CPTI_KEYED_CLASSES, keyed_classes): Delete. (keyed_classes): Declare as vector. * decl.c (keyed_classes): Define. (cxx_init_decl_processing): Allocate it. (record_key_method_defined): Use vec_safe_push. * class.c (finish_struct_1): Likewise. * pt.c (instantiate_class_template_1): Likewise. * decl2.c (c_parse_final_cleanups): Reverse iterate keyed_classes. Make rtti lazier * rtti.c (enum tinfo_kind): Add TK_DERIVED_TYPES, TK_VMI_CLASS_TYPES, TK_MAX. Delete TK_FIXED. (tinfo_names): New. (typeid_ok_p): Add quotes to error messages. Use get_tinfo_desc. (get_tinfo_decl): Use get_tinfo_desc. (get_pseudo_ti_init): Likewise. Adjust VMI construction. (create_pseudo_type_info): Delete. (get_pseudo_ti_index): Just determine the index. (get_tinfo_desc): New. Create all types lazily. (create_tinfo_types): Just allocate the descriptor array. (emit_support_tinfos): Use non-inserting type lookup. Set builtin location. 2017-06-15 Martin Sebor PR c++/80560 * call.c (first_non_public_field, maybe_warn_class_memaccess): New functions. (has_trivial_copy_assign_p, has_trivial_copy_p): Ditto. (build_cxx_call): Call maybe_warn_class_memaccess. 2017-06-14 Jakub Jelinek * cp-gimplify.c (cp_genericize_r): Turn most of the function into a switch (TREE_CODE (stmt)) statement from long else if sequence. 2017-06-13 Jakub Jelinek PR c++/80973 * cp-gimplify.c (cp_genericize_r): Don't instrument MEM_REF second argument even if it has REFERENCE_TYPE. PR c++/80984 * cp-gimplify.c (cp_genericize): Only look for VAR_DECLs in BLOCK_VARS (outer) chain. (cxx_omp_const_qual_no_mutable): Likewise. 2017-06-13 Martin Liska PR sanitize/78204 * class.c (build_base_path): Use sanitize_flags_p. * cp-gimplify.c (cp_genericize_r): Likewise. (cp_genericize_tree): Likewise. (cp_genericize): Likewise. * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise. * decl.c (compute_array_index_type): Likewise. (start_preparsed_function): Likewise. * decl2.c (one_static_initialization_or_destruction): Likewise. * init.c (finish_length_check): Likewise. * lambda.c (maybe_add_lambda_conv_op): Likewise. * typeck.c (cp_build_binary_op): Likewise. (build_static_cast_1): Likewise. 2017-06-11 Jason Merrill * error.c (dump_expr): Use is_this_parameter. * cp-tree.h, decl2.c, mangle.c, parser.c, pt.c, semantics.c: Use id_equal. 2017-06-09 Jason Merrill Missing bits from N4268, constant evaluation for all non-type args. * call.c (build_converted_constant_expr): Rename from build_integral_nontype_arg_conv, handle all types. * pt.c (convert_nontype_argument): In C++17 call it for all types. Move NOP stripping inside pointer case, don't strip ADDR_EXPR. * cvt.c (strip_fnptr_conv): Also strip conversions to the same type. Overhaul pointer-to-member conversion and template argument handling. * call.c (standard_conversion): Avoid creating ck_pmem when the class type is the same. * cvt.c (can_convert_qual): Split from perform_qualification_conversions. * constexpr.c (cxx_eval_constant_expression): Check it. * typeck.c (convert_ptrmem): Only cplus_expand_constant if adjustment is necessary. * pt.c (check_valid_ptrmem_cst_expr): Compare class types. (convert_nontype_argument): Avoid redundant error. * call.c (convert_like_real): Remove "inner" parameter. Don't replace a constant with its value. * cp-gimplify.c (cp_fully_fold): Use cp_fold_rvalue. * pt.c (convert_nontype_argument): Check NULLPTR_TYPE_P rather than nullptr_node. * parser.c (cp_parser_constant_expression): Check potential_rvalue_constant_expression after decay_conversion. * pt.c (convert_nontype_argument): Don't require linkage in C++17. PR c++/80384 - ICE with dependent noexcept-specifier * pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent noexcept-specifier. * constexpr.c (potential_constant_expression_1): Allow 'this' capture. 2017-06-09 Jan Hubicka * class.c (build_vtbl_initializer): Mark dvirt_fn as cold. * decl.c (cxx_init_decl_processing, push_throw_library_fn): Likewise. (excpet.c): Mark terminate as cold. 2017-06-08 Jakub Jelinek PR c/81006 * semantics.c (handle_omp_array_sections_1): Convert TYPE_MAX_VALUE to sizetype before size_binop. PR c++/81011 * cp-gimplify.c (cxx_omp_finish_clause): When changing clause to OMP_CLAUSE_SHARED, also clear OMP_CLAUSE_SHARED_FIRSTPRIVATE and OMP_CLAUSE_SHARED_READONLY flags. 2017-06-08 Jan Hubicka * cp-tree.h (lang_check_failed): Annotate by ATTRIBUTE_COLD. 2017-06-07 Nathan Sidwell * class.c (layout_class_type): Restructure overlong-bitfield tpe search. 2017-06-07 Jonathan Wakely PR c++/80990 * pt.c (do_class_deduction): Build qualified type. 2017-06-06 Nathan Sidwell * name-lookup.c (suggest_alternatives_for): Use qualified lookup sans using directives. Don't walk into inline namespaces. PR c++/80979 * name-lookup.c (adl_class_only): Don't add visible friends. 2017-06-05 Volker Reichelt * parser.c (cp_parser_base_specifier): Fix typos in error messages. 2017-06-02 Nathan Sidwell Remove lang_type_ptrmem. * cp-tree.h (lang_type_header): Remove is_lang_type_class. Move into ... (lang_type_class): ... this. Reorder bitfields. Rename to ... (lang_type): ... this. Delete old definition. (lang_type_ptrmem): Delete. (LANG_TYPE_CLASS_CHECK): Simply get TYPE_LANG_SPECIFIC. Adjust uses. (LANG_TYPE_PTRMEM_CHECK): Delete. (TYPE_GET_PTRMEMFUNC_TYPE, TYPE_SET_PTRMEMFUNC_TYPE): Delete. (TYPE_PTRMEMFUNC_TYPE): New. Use TYPE_LANG_SLOT_1. * decl.c (build_ptrmemfunc_type): Adjust. * lex.c (copy_lang_type): Remove lang_type_ptrmem handling. (maybe_add_lang_type_raw): Don't set u.c.h.is_lang_type_class. * class.c (check_bases_and_members): Adjust vec_new_uses_cookie setting. Remove cp_binding_level::namespaces * name-lookup.h (cp_binding_level): Lose namespaces field. * name-lookup.c (add_decl_to_level): Chain namespaces on the names list. (suggest_alternatives_for): Adjust for namespace list. Do breadth-first search. * decl2.c (collect_source_refs): Namespaces are on the regulr list. (collect_ada_namespace): Likewise. 2017-06-02 Bernd Edlinger * typeck.c (cp_build_binary_op): Implement the -Wsizeof_pointer_div warning. 2017-06-01 Ville Voutilainen PR c++/80812 * method.c (constructible_expr): Strip array types before calling build_value_init. 2017-06-01 Paolo Carlini PR c++/80896 * cvt.c (convert_to_void): Possibly call maybe_warn_nodiscard for case INDIRECT_REF too in the main switch. 2017-05-31 Jason Merrill PR c++/80840 - ICE with constexpr and reference * pt.c (convert_nontype_argument): Don't test whether a decl is value-dependent when binding to a reference. 2017-05-31 Nathan Sidwell * cp-tree.h (lang_decl_slector): New enum. (lang_decl_base): Make selector an enum. Drop decomposition_p field. (lang_decl): Use enum for discrimination. (LANG_DECL_FN_CHECK, LANG_DECL_NS_CHECK, LANG_DECL_PARM_CHECK, LANG_DECL_DEOMP_CHECK): Use enum. (DECL_DECOMPOSITION_P): Use selector value. (SET_DECL_DECOMPOSITION_P): Delete. (retrofit_lang_decl): Lose SEL parm. (fit_decomposition_lang_decl): Declare. * decl.c (cp_finish_decomp, grokdeclarator): Use fit_decomposition_lang_decl. * lex.c (maybe_add_lang_decl_raw): New. Broken out of retrofit_lang_decl. (set_decl_linkage): New. Broken out of retrofit_lang_decl. Use enum. (fit_decomposition_lang_decl): Likewise. (retrofit_lang_decl): Use worker functions. (cxx_dup_lang_specific_decl): Use selector enum. (maybe_add_lang_type_raw): New. Broken out of ... (cxx_make_type_name): ... here. Call it. 2017-05-30 Jason Merrill PR c++/80856 - ICE with local extern in template * semantics.c (finish_call_expr): Replace a local extern overload set in a template with the IDENTIFIER_NODE. 2017-05-30 David Malcolm * call.c (perform_implicit_conversion_flags): Convert "from %qT to %qT" to "from %qH to %qI" in diagnostic. (print_conversion_rejection): Replace pairs of %qT with %qH and %qI in various places. (build_user_type_conversion_1): Likewise. (build_integral_nontype_arg_conv): Likewise. (build_conditional_expr_1): Likewise. (convert_like_real): Likewise. (convert_arg_to_ellipsis): Likewise. (joust): Likewise. (initialize_reference): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (cp_convert_to_pointer): Likewise. (convert_to_reference): Likewise. (ocp_convert): Likewise. * error.c (cp_printer): Gain bool and const char ** parameters. (struct deferred_printed_type): New struct. (class cxx_format_postprocessor): New class. (cxx_initialize_diagnostics): Wire up a cxx_format_postprocessor to pp->m_format_postprocessor. (comparable_template_types_p): New function. (newline_and_indent): New function. (arg_to_string): New function. (print_nonequal_arg): New function. (print_template_differences): New function. (type_to_string_with_compare): New function. (print_template_tree_comparison): New function. (append_formatted_chunk): New function. (add_quotes): New function. (cxx_format_postprocessor::handle): New function. (defer_phase_2_of_type_diff): New function. (cp_printer): Add "quoted" and "buffer_ptr" params. Implement %H and %I. * typeck.c (cp_build_binary_op): Replace pairs of %qT with %qH and %qI in various places. (convert_member_func_to_ptr): Likewise. (build_reinterpret_cast_1): Likewise. (convert_for_assignment): Likewise. * typeck2.c (check_narrowing): Likewise. 2017-05-30 Nathan Sidwell Kill IDENTIFIER_NAMESPACE_BINDINGS * cp-tree.h (lang_identifier): Delete namespace_bindings. (IDENTIFIER_NAMESPACE_BINDINGS): Delete. (lang_decl_ns): Add bindings. (DECL_NAMESPACE_BINDINGS): New. * lex.c (retrofit_lang_decl): Create namespace hash table. * name-lookup.c (find_namespace_slot): Change to use hash-map. * ptree.c (cxx_print_binding): Delete. (cxx_print_identifier): Remove NAMESPACE_BINDING printing. * cp-tree.def (OVERLOAD): Fix comment. * cp-tree.h: Fix comments and whitespace. * error.c (dump_decl): Use pp_cxx_colon_colon, ovl_scope. * name-lookup.c (add_decl_to_level): Assert not class. (check_local_shadow): Use OVL_P. (pushdecl_with_scope_1): Rename to ... (do_pushdecl_with_Scope): ... here. (do_nonmember_using_decl): Use qualified_namespace_lookup return value. (push_class_level_binding_1): Use OVL_P. (pushdecl_namespace_level): Use do_pushdecl_with_scope. (pushtag_1): Rename to ... (do_pushtag): ... here. Adjust do_pushdecl_with_scope call. (pushtag): Adjust. (store_class_bindings): Do not time here. * name-lookup.h (pushdecl_outermost_localscope): Reorder. * pt.c (listify): Declare argvec at point of initialization. PR c++/80913 * name-lookup.c (add_decl_to_level): Assert not making a circular chain. (update_binding): Don't prematurely slide artificial decl. 2017-05-29 Alexandre Oliva * cp-tree.h (lang_identifier): Drop oracle_looked_up, unused. 2017-05-29 Nathan Sidwell PR c++/80891 (#1,#5) * cp-tree.h (lookup_maybe_add): Add DEDUPING argument. * name-lookup.c (name_lookup): Add deduping field. (name_lookup::preserve_state, name_lookup::restore_state): Deal with deduping. (name_lookup::add_overload): New. (name_lookup::add_value, name_lookup::add_fns): Call add_overload. (name_lookup::search_adl): Set deduping. Don't unmark here. * pt.c (most_specialized_instantiation): Revert previous change, Assert not given duplicates. * tree.c (lookup_mark): Just mark the underlying decls. (lookup_maybe_add): Dedup using marked decls. PR c++/80891 (#4) * ptree.c (cxx_print_xnode): Show internal OVERLOAD structure. * tree.c (ovl_insert, ovl_iterator_remove_node): Fix copying assert. Stat hack representation * name-lookup.c (STAT_HACK_P, STAT_TYPE, STAT_DECL, MAYBE_STAT_DECL, MAYBE_STAT_TYPE): New. (stat_hack): New. (find_namespace_binding): Replace with ... (find_namespace_slot): ... this. (find_namespace_value): New. (name_lookup::search_namespace_only, name_lookup::adl_namespace_only): Adjust. (update_binding): Add SLOT parameter, adjust. (check_local_shadow): Use find_namespace_value. (set_local_extern_decl_linkage): Likewise. (do_pushdecl): Adjust for namespace slot. (push_local_binding): Assert not a namespace binding. (check_for_out_of_scope_variable): Use find_namespace_value. (set_identifier_type_value_with_scope): Likewise. (get_namespace_binding): Likewise. (set_namespace_binding): Delete. (set_global_binding): Directly update the binding. (finish_namespace_using_decl): Likewise. (lookup_type_scope_1): Use find_namespace_slot and update. (do_push_nested_namespace): Use find_namespace_value. PR c++/80891 (#1) * pt.c (most_specialized_instantiation): Cope with duplicate instantiations. PR c++/80891 (#3) * cp-tree.h (build_min_nt_call_vec): Declare. * decl.c (build_offset_ref_call_from_tree): Call it. * parser.c (cp_parser_postfix_expression): Likewise. * pt.c (tsubst_copy_and_build): Likewise. * semantics.c (finish_call_expr): Likewise. * tree.c (build_min_nt_loc): Keep unresolved lookups. (build_min): Likewise. (build_min_non_dep): Likewise. (build_min_non_dep_call_vec): Likewise. (build_min_nt_call_vec): New. PR c++/80891 (#2) * tree.c (ovl_copy): Adjust assert, copy OVL_LOOKUP. (ovl_used): New. (lookup_keep): Call it. 2017-05-26 Nathan Sidwell Implement DR2061 * name-lookup.c (push_inline_namespaces): New. (push_namespace): Look inside inline namespaces. Inline and using namespace representation change. * cp-tree.h (struct lang_decl_ns): Delete ns_using. Add usings, inlinees as vector. (DECL_NAMESPACE_USING): Adjust. (DECL_NAMESPACE_INLINEES): New. * name-lookup.h (struct cp_binding_level): Change usings representation. * name-lookup.c (name_lookup::do_queue_usings, name_lookup::queue_usings): Adjust. (name_lookup::search_namespace, name_lookup::search_usings, name_lookup::queue_namespace): Adjust. (name_lookup::adl_namespace_only): Adjust. (add_using_namespace, push_namespace): Push onto vector. (pop_namespace): Add timing logic. * call.c (build_operator_new_call): Do namelookup and ADL here. (build_new_op_1): Likewise. * name-lookup.h (lookup_function_nonclass): Delete declaration. (do_using_directive): Likewise. * name-lookup.c (set_namespace_binding, push_local_binding): Don't declare early. (struct scope_binding): Delete. (EMPTY_SCOPE_BINDING): Delete. (set_decl_namespace): Use OVL_P. (finish_local_using_decl): Lose unnecesary checks. (lookup_function_nonclass): Delete. (cp_emit_debug_info_for_using): Use MAYBE_BASELINK_P. * cp-tree.h (OVL_CHAIN): Check looking at OVERLOAD. (ovl_iterator): Add allow_inner field. Adjust ctor. Make unduplicatable. (ovl_iterator::maybe_push, ovl_iterator::pop): New. (lkp_iterator): Add outer field. Adjust ctor. (lkp_iterator::operator++): New. (lookup_mark, lookup_maybe_add): Declare. * name-lookup.c (name_lookup): Delete fn_set member. (name_lookup::preserve_state, name_lookup::restore_state): Unmark and mark lookup. (name_lookup::add_value): Use lookup_add directly. (name_lookup::add_fns: Use lookup_maybe_add. (name_lookup::search_adl): Mark and unmark fns. (pushdecl): Adjust. * pt.c (check_explicit_specialization): Use lookup_add directly. * ptree.c (cxx_print_xnode): Show complete overload structure. * tree.c (lookup_mark, lookup_maybe_add): New. * name-lookup.c (name_lookup::search_adl): ADL OMP UDR type args. 2017-05-26 Jakub Jelinek * cp-tree.h (struct lang_decl_decomp): New type. (struct lang_decl): Add u.decomp. (LANG_DECL_DECOMP_CHECK): Define. (DECL_DECOMPOSITION_P): Note it is set also on the vars for user identifiers. (DECL_DECOMP_BASE): Define. (retrofit_lang_decl): Add extra int = 0 argument. * lex.c (retrofit_lang_decl): Add SEL argument, if non-zero use it to influence the selector choices and for selector 0 to non-zero transition copy old content. (cxx_dup_lang_specific_decl): Handle DECL_DECOMPOSITION_P. * decl.c (poplevel): For DECL_DECOMPOSITION_P, check !DECL_DECOMP_BASE instead of !DECL_VALUE_EXPR. Adjust warning wording if decl is a structured binding. (cp_finish_decomp): Pass 4 as the new argument to retrofit_lang_decl. Set DECL_DECOMP_BASE. Ignore DECL_READ_P sets from initialization of individual variables for tuple structured bindings. (grokdeclarator): Pass 4 as the new argument to retrofit_lang_decl. Clear DECL_DECOMP_BASE. * decl2.c (mark_used): Mark DECL_DECOMP_BASE TREE_USED as well. * pt.c (tsubst_decomp_names): Assert DECL_DECOMP_BASE matches what is expected. * expr.c (mark_exp_read): Recurse on DECL_DECOMP_BASE instead of DECL_VALUE_EXPR. 2017-05-25 Jason Merrill PR c++/80605 - __is_standard_layout and zero-length array * class.c (check_bases): Use DECL_FIELD_IS_BASE. 2017-05-25 Nathan Sidwell Kill OVL_CURRENT, OVL_NEXT. * cp-tree.h (OVL_CURRENT, OVL_NEXT): Delete. * name-lookup.c (set_decl_namespace): Use ovl_iterator. (consider_binding_level): Use OVL_FIRST. (cp_emit_debug_info_for_using): Use lkp_iterator. * pt.c (check_explicit_specialization): Use ovl_iterator. Kill DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS. * cp-tree.h (lang_decl_ns): Remove ns_users field. (DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS): Delete. (TREE_INDIRECT_USING): Delete. * name-lookup.h (is_associated_namespace): Delete. * name-lookup.c (name_lookup::search_usings, name_lookup::do_queue_usings): Usings are always direct. (is_associated_namespace): Delete. (handle_namespace_attrs): Use DECL_NAMESPACE_INLINE_P. (namespace_ancestor_1, namespace_ancestor): Delete. (push_using_directive_1, push_using_directive): Delete. (add_using_namespace_1): Delete. (add_using_namespace): Reimplement. (emit_debug_info_using_namespace): New. (finish_namespace_using_directive, finish_local_using_directive, push_namespace): Adjust. * tree.c (cp_free_lang_data): Remove DECL_NAMESPACE_USERS handling. 2017-05-25 Volker Reichelt * semantics.c (finish_handler_parms): Warn about non-reference type catch handlers. 2017-05-25 Nathan Sidwell Reimplement unqualified namespace lookup. * name-lookup.c (name_lookup::using_pair, name_lookup::using_queue): New typedefs. (name_lookup::queue_namespace, name_lookup::do_queue_usings, name_lookup::queue_usings): New. (name_lookup::search_unqualified): New. (merge_functions, same_entity_p, ambiguous_decl, unqualified_namespace_lookup_1, unqualified_namespace_lookup, lookup_using_namespace): Delete. (lookup_name_real_1): Adjust. Reimplement qualified namespace lookup. * name-lookup.c (name_lookup::flags): New member. Adjust ctor. (name_lookup::ambiguous, name_lookup::add_value, name_lookup::add_type, name_lookup::process_binding): New. (name_lookup::search_namespace_only, name_lookup::search_namespace, name_lookup::search_usings): New. (name_lookup::search_qualified): New. (do_nonmember_using_decl, suggest_alternatives_for, lookup_qualified_name): Adjust. (tree_vec_contains): Delete. (qualified_lookup_using_namespace): Rename to ... (qualified_namespace_lookup): ... here. Reimplement. Reimplement ADL. * cp-tree.h (LOOKUP_SEEN_P, LOOKUP_FOUND_P): New. * name-lookup.h (lookup_arg_dependent): Return plain tree. * name-lookup.c (arg_lookup, arg_assoc, arg_assoc_args, arg_assoc_args_vec, arg_assoc_type, add_function, arg_assoc_namespace, arg_assoc_class_only, arg_assoc_bases, arg_assoc_class, arg_assoc_template_arg, arg_assoc, lookup_arg_dependent_1): Delete. (name_lookup): New lookup object. (name_lookup::preserve_state, name_lookup::restore_state, name_lookup::mark_seen, name_lookup::find_and_mark, name_lookup::add_fns, name_lookup::adl_namespace_only, name_lookup::adl_namespace, name_lookup::adl_class_only, name_lookup::adl_bases, name_lookup::adl_class, name_lookup::adl_expr, name_lookup::adl_type, name_lookup::adl_template_arg, name_lookup::search_adl): New. (lookup_arg_dependent): Return a plain tree. Adjust. (is_associated_namespace): Move later. 2017-05-24 Nathan Sidwell * friend.c (do_friend): Remove check for existing decl. * name-lookup.h (lookup_name_innermost_nonclass_level): Delete. * name-lookup.c (push_local_binding): Directly look for binding. (lookup_name_innermost_nonclass_level_1): Delete. (lookup_name_innermost_nonclass_level): Delete. * Make-lang.in (CXX_AND_OBJCXX_OBJS): Alphabetize. * cp-tree.h (cp_free_lang_data): Add extern. (ovl_skip_hidden, is_overloaded_fn, really_overloaded_fn): Add ATTRIBUTE_PURE. (type_unknown_p): Return bool, make inline, lose TREE_LIST check. * typeck.c (type_unknown_p): Delete. * tree.c (is_overloaded_fn): Use MAYBE_BASELINE_FUNCTIONS, adjust overload management. (dependent_name): Likewise. (decl_anon_ns_mem_p): Simplify. 2017-05-24 Jonathan Wakely PR c++/80544 * tree.c (reshape_init): Use unqualified type for direct enum init. * typeck.c (maybe_warn_about_cast_ignoring_quals): New. (build_static_cast_1, build_reinterpret_cast_1): Strip cv-quals from non-class destination types. (build_const_cast_1): Strip cv-quals from destination types. (build_static_cast, build_reinterpret_cast, build_const_cast) (cp_build_c_cast): Add calls to maybe_warn_about_cast_ignoring_quals. 2017-05-24 Martin Sebor PR c/80731 * call.c (fully_fold_internal): Adjust. 2017-05-24 Nathan Sidwell * cp-tree.h (ovl_skip_hidden): Declare. * tree.c (ovl_skip_hidden): New. * name-lookup.c (arg_assoc_namespace): Call ovl_skip_hidden. (lookup_arg_dependent_1): Likewise. (ambiguous_decl): Use DECL_HIDDEN_P, ovl_skip_hidden. (hidden_name_p, remove_hidden_names): Delete. (lookup_name_real_1): Do not strip hidden names. * name-lookup.h (hidden_name_p, remove_hidden_names): Delete. * cp-tree.h (OVL_HIDDEN_P): New. (ovl_iterator::hidden_p, ovl_iterator::reveal_node): New. (ovl_iterator::reveal_node): Declare. * tree.c (ovl_copy): Copy OVL_HIDDEN_P. (ovl_insert): Order on hiddenness. (ovl_iterator::reveal_node): New. * name-lookup.c (anticipated_builtin_p): New. (supplement_binding_1): Use it. (set_local_extern_decl_linkage): Use hidden_p. (do_pushdecl): Deal with unhiding a hidden decl, use anticipated_builtin_p. (do_nonmember_using_decl): Use anticipated_decl_p. (lookup_name_real_1): Use DECL_HIDDEN_P. 2017-05-23 Jason Merrill -Wunused and C++17 structured bindings * decl.c (poplevel): Don't warn about unused structured bindings, only real variables. * error.c (dump_simple_decl): Handle structured bindings. * expr.c (mark_exp_read): Look through DECL_VALUE_EXPR. 2017-05-23 Nathan Sidwell * cp-tree.h (PUSH_GLOBAL, PUSH_LOCAL, PUSH_USING): Delete. * name-lookup.c (create_local_binding): New. (update_binding): New. (pushdecl_maybe_friend_1): Rename to ... (do_pushdecl): ... this. Reimplement. (pushdecl): Adjust. (push_overloaded_decl_1, push_overloaded_decl): Delete. 2017-05-23 Jason Merrill PR c++/80396 - built-in for make_integer_sequence. * pt.c (builtin_pack_fn_p, builtin_pack_call_p) (expand_integer_pack, expand_builtin_pack_call): New. (find_parameter_packs_r): Check builtin_pack_call_p. (check_for_bare_parameter_packs): Handle it. (tsubst_pack_expansion): Call expand_builtin_pack_call. (declare_integer_pack): New. (init_template_processing): Call it. * decl2.c (mark_used): Check builtin_pack_fn_p. 2017-05-23 Nathan Sidwell * name-lookup.c (find_namespace_binding): New. (pushdecl_maybe_friend_1): Use CP_DECL_CONTEXT. (set_identifier_type_value_with_scope): Use find_namespace_binding. (find_binding, cp_binding_level_find_binding_for_name, binding_for_name, namespace_binding_1): Delete. (push_overloaded_decl_1): Use CP_DECL_CONTEXT. (get_namespace_binding, set_namespace_binding, finish_namespace_using_decl, unqualified_namespace_lookup_1, qualified_lookup_using_namespace, lookup_type_scope_1, lookup_name_innermost_nonclass_level_1): Use find_namespace_binding. PR c++/80866 * parser.c (cp_parser_template_id): Keep the lookup when stashing the template_id. * cp-tree.h (DECL_HIDDEN_P): New. * name-lookup.c (set_decl_context, set_local_extern_decl_linkage): New, broken out of ... (pushdecl_maybe_friend_1): ... here. Call them. 2017-05-23 Thomas Schwinge * parser.c (OACC_KERNELS_CLAUSE_MASK): Add "PRAGMA_OACC_CLAUSE_NUM_GANGS", "PRAGMA_OACC_CLAUSE_NUM_WORKERS", "VECTOR_LENGTH". 2017-05-23 Nathan Sidwell * cp-tree.h (OVL_P): New. * name-lookup.h (push_local_binding): Delete. (do_toplevel_using_decl, do_local_using_decl): Rename to ... (finish_namespace_using_decl, finish_local_using_decl): ... here * name-lookup.c (add_decl_to_level): Swap args. (pop_bindings_and_leave_scope): Look inside TREE_LIST. (diagnose_name_conflict): Check contexts are same for redecl. (update_local_overload): New. (compparms_for_decl_and_using): Rename to ... (matching_fn_p): ... here. (pushdecl_maybe_friend_1): Adjust add_decl_to_level, push_local_bindings call. (push_local_binding): Make static, replace FLAGS arg with IS_USING. (validate_nonmember_using_decl): Use OVL_FIRST. (do_nonmember_using_decl): Use in/out parameters. Use lkp_iterator and simplify. (do_toplevel_using_decl, do_local_using_decl): Rename to ... (finish_namespace_using_decl, finish_local_using_decl): ... here. Adjust. (lookup_type_current_level): Delete. * parser.c (cp_parser_using_declaration): Adjust. * pt.c (tsubst_expr): Adjust. 2017-05-22 Nathan Sidwell * name-lookup.h (parse_using_directive): Replace with ... (finish_namespace_using_directive): ... this and ... (finish_local_using_directive): ... this. * name-lookup.c (add_using_namespace_1): Move later. (add_using_namespace): Move later, add namespace_p arg, remove indirect arg. (push_using_directive_1): Directly recurse. (do_using_directive, parse_using_directive): Delete, split into ... (finish_namespace_using_directive): ... this and ... (finish_local_using_directive): ... this. (push_namespace): Use add_using_namespace. * parser.c (cp_parser_using_directive): Call finish_namespace_using_directive or finish_local_using_directive. * pt.c (tsubst_expr): Call finish_local_using_directive. * cp-objcp-common.c (cp_register_dumps): Register raw dumper. * cp-tree.h (raw_dump_id): Declare. * decl2.c (raw_dump_id): Define. (dump_tu): Use raw_dump_id. * config-lang.in (gtfiles): Sort list, break lines. * cp-tree.h (CPTI_TERMINATE, CPTI_CALL_UNEXPECTED): Rename to ... (CPTI_TERMINATE_FN, CPTI_CALL_UNEXPECTED_FN): ... here. ( CPTI_GET_EXCEPTION_PTR_FN, CPTI_BEGIN_CATCH_FN, CPTI_END_CATCH_FN, CPTI_ALLOCATE_EXCEPTION_FN, CPTI_FREE_EXCEPTION_FN, CPTI_THROW_FN, CPTI_RETHROW_FN): New. (noexcept_deferred_spec): New. (terminate_node, call_unexpected_node): Rename to ... (terminate_fn, call_unexpected_fn): ... here. (get_exception_ptr_fn, begin_catch_fn, end_catch_fn, allocate_exception_fn, free_exception_fn, throw_fn, rethrow_fn): New. * except.c (fn1..fn5, throw_fn, rethrow_rn, spec): Delete. (init_exception_processing): Adjust. (declare_library_fn): Create and push the fns here. (do_get_exception_ptr, do_begin_catch, do_end_catch, do_allocate_exception_ptr, do_free_exception_ptr): Adjust declare_library_fn use. (unevaluated_noexcept_spec): Adjust. * cp-gimplify.c (genericize_eh_spec_block, gimplify_most_not_throw_expr): Adjust. * name-lookup.c (pushdecl_top_level, pushdecl_top_level_and_finish): Move after namespace pushing and popping functions. (push_to_top_level): Rename to ... (do_push_to_top_level): ... here. Remove timing code. (pop_from_top_level_1): Rename to ... (do_pop_from_top_level): ... here. (do_push_nested_namespace, do_pop_nested_namespace) (push_to_top_level): New wrapper for do_push_to_top_level. (pop_from_top_level): Adjust. (push_nested_namepace, pop_nested_namespace): Wrappers for workers. 2017-05-19 Bernd Edlinger * config-lang.in (gtfiles): Add c-family/c-format.c, except.c, init.c, lambda.c and friend.c. * class.c (dvirt_fn): Move out of function scope, add GTY attribute. * except.c (fn1-5, throw_fn, rethrow_fn, spec): Likewise. * init.c (fn): Likewise. * lambda.c (ptr_id, max_id): Likewise. * friend.c (global_friend): Add GTY attribute. 2017-05-19 Nathan Sidwell * call.c (add_list_candidates): Use OVL_FIRST. (build_new_method_call_1): Likewise. * cp-tree.h (OVL_SINGLE_P): New. (TYPE_HIDDEN_P): New. * decl.c (xref_tag_1): Use TYPE_HIDDEN_P. * dump.c (cp_tump_tree): Adjust overload dumping. * error.c (dump_decl): Use OVL_SINGLE_P, simplify context printing. * method.c (lazily_declare_fn): Assert we added it. * parser.c (cp_parser_nested_name_specifier): Use OVL_SINGLE_P, OVL_FIRST. (cp_parser_template_name): Use lkp_iterator. * pt.c (begin_template_parm_list): Fixup comment. (instantiate_class_template_1): Use TYPE_HIDDEN_P. * tree.c (ovl_iterator::remove_node): Cope with inherited ctors. (ovl_scope): Use lkp_iterator. 2017-05-19 Thomas Schwinge * parser.c (cp_parser_omp_clause_default): Handle "OMP_CLAUSE_DEFAULT_PRESENT". * parser.c (cp_parser_omp_clause_default): Avoid printing more than one syntax error message. 2017-05-19 Nathan Sidwell * class.c (class_dump_id): Define. (dump_class_hierarchy, dump_vtable, dump_vtt): Use it. * cp-objcp-common.c (cp_register_dumps): New. * cp-objcp-common.h (cp_register_dumps): Declare. (LANG_HOOKS_REGISTER_DUMPS): Override. * cp-tree.h (class_dump_id): Declare. 2017-05-18 Nathan Sidwell * cp-tree.h (OVL_ARG_DEPENDENT): Delete. (OVL_USED_P): New. (lookup_keep): Declare. * name-lookup.c (add_function): Don't set OVL_ARG_DEPENDENT. * pt.c (tsubst_copy): Assert lookup is persistent. * semantics.c (finish_call_expr): Use lkp_iterator, call lookup_keep. * tree.c (ovl_copy): New. (ovl_insert, ovl_iterator::remove_node): Copy immutable nodes. (lookup_keep): New. * cp-tree.h (OVL_USED): Replace with ... (OVL_USING_P): ... this. (ovl_iterator::using_p): Adjust. * name-lookup.c (push_overloaded_decl_1, do_nonmember_using_decl): Adjust. * search.c (lookup_field_r): Adjust. * tree.c (ovl_insert, ovl_scope): Adjust. * cp-tree.h (lookup_add): Swap args. (ovl_cons, build_overload): Delete. * name-lookup.c (add_function, push_overloaded_decl_1, do_nonmember_using_decl, merge_functions, remove_hidden_names): Use lookup_add, ovl_insert. * pt.c (check_explicit_specialization): Use lookup_add. (do_class_deduction): Likewise. Refactor if. * tree.c (lookup_add): Swap args. (ovl_cons, build_overload): Delete. * name-lookup.c (find_local_binding): New, broken out of ... (lookup_name_innermost_nonclass_level_1): ... here. Call it. (set_namespace_binding): Swap scope & name args. (namespace_binding_1): Likewise. (pushdecl_maybe_friend_1): Adjust set_namespace_binding call. (push_overloaded_decl_1): Likewise. (set_global_binding): Likewise. (get_namespace_binding): Adjust namespace_binding_1 call. 2017-05-17 Nathan Sidwell * cp-tree.h (default_hash_traits ): New specialization. * name-lookup.c (lookup_extern_c_fun_in_all_ns): Delete. (extern_c_fns): New hash table. (check_extern_c_conflict): New, broken out of ... (pushdecl_maybe_friend_1): ... here. Call it. (c_linkage_bindings): Just look in hash table. 2017-05-17 Ville Voutilainen PR c++/80654 PR c++/80682 Implement new C++ intrinsics __is_assignable and __is_constructible. * cp-tree.h (CPTK_IS_ASSIGNABLE, CPTK_IS_CONSTRUCTIBLE): New. (is_xible): New. * cxx-pretty-print.c (pp_cxx_trait_expression): Handle CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE. * method.c (constructible_expr): Set cp_unevaluated. (is_xible_helper): New. (is_trivially_xible): Adjust. (is_xible): New. * parser.c (cp_parser_primary_expression): Handle RID_IS_ASSIGNABLE and RID_IS_CONSTRUCTIBLE. (cp_parser_trait_expr): Likewise. * semantics.c (trait_expr_value): Handle CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE. 2017-05-17 Nathan Sidwell * cp-tree.h (ovl_iterator::using_p): New predicate. (ovl_iterator::remove_node): New worker. (ovl_insert): Declare. * tree.c (ovl_insert): New. (ovl_iterator::remove_node): New. * class.c (add_method): Use ovl_iterator, ovl_insert. (clone_function_decl): Fix description. (clone_constructors_and_destructors): Use ovl_iterator. * class.c (handle_using_decl): Use OVL_FIRST, ovl_iterator. (maybe_warn_about_overly_private_class): Use ovl_iterator. (method_name_cmp, resort_method_name_cmp): Use OVL_NAME. (resort_type_method_vec, finish_struct_methods): Use OVL_FIRST. (get_base_fndecls): Use ovl_iterator. (warn_hidden): Use OVL_NAME, ovl_iterator. (add_implicitly_declared_members): Use ovl_iterator. * constraint.cc (normalize_template_id_expression): Use OVL_FIRST, flatten nested if. (finish_shorthand_constraint): Simplify, use ovl_make. * pt.c (make_constrained_auto): Simplify. Use ovl_make. * search.c (shared_member_p): Use ovl_iterator. (lookup_field_fuzzy_info::fuzzy_lookup_fn): Use OVL_NAME. (lookup_conversion_operator): Use OVL_FIRST. (lookup_fnfiels_idx_nolazy): Use OVL_FIRST, OVL_NAME. (look_for_overrides_here): Use ovl_iterator. (lookup_conversions_r): Use OVL_FIRST, OVL_NAME, ovl_iterator. * typeck.c (build_x_unary_op): Use ovl_make. 2017-05-17 Martin Liska * class.c (dump_class_hierarchy): Introduce dump_flags_t type and use it instead of int type. (dump_vtable): Likewise. (dump_vtt): Likewise. * decl2.c (dump_tu): Likewise. 2017-05-16 David Malcolm * call.c (enforce_access): Add access_failure_info * param and use it to record access failures. * cp-tree.h (class access_failure_info): New class. (enforce_access): Add access_failure_info * param, defaulting to NULL. (lookup_member): Likewise. (locate_field_accessor): New function decl. (perform_or_defer_access_check): Add access_failure_info * param, defaulting to NULL. * search.c (lookup_member): Add access_failure_info * param and pass it on to call to perform_or_defer_access_check. (matches_code_and_type_p): New function. (field_access_p): New function. (direct_accessor_p): New function. (reference_accessor_p): New function. (field_accessor_p): New function. (struct locate_field_data): New struct. (dfs_locate_field_accessor_pre): New function. (locate_field_accessor): New function. * semantics.c (perform_or_defer_access_check): Add access_failure_info * param, and pass it on to call to enforce_access. * typeck.c (access_failure_info::record_access_failure): New method. (access_failure_info::maybe_suggest_accessor): New method. (finish_class_member_access_expr): Pass an access_failure_info instance to the lookup_member call, and call its maybe_suggest_accessor method afterwards. 2017-05-16 Marek Polacek PR sanitizer/80536 PR sanitizer/80386 * cp-gimplify.c (cp_fold): Handle SAVE_EXPR. 2017-05-16 Nathan Sidwell * name-lookup.c (check_local_shadow): New, broke out of ... (pushdecl_maybe_friend_1): ... here. Call it. * cp-tree.h (OVL_NESTED_P, OVL_LOOKUP_P): New. (ovl_first): Move inline definition to end of file. (ovl_make, lookup_add): Declare. (get_fns, get_first_fn): Make pure. * tree.c (ovl_cache): New. (ovl_make, lookup_add): New. * pt.c (do_class_deduction): Don't add candidates that will be elided. * call.c (build_user_type_conversion_1): Use OVL_FIRST. (print_error_for_call_failure): Use OVL_NAME. (build_op_call_1): Use ovl_iterator. (add_candidates): Use OVL_FIRST & lkp_iterator. (build_op_delete_call): Use MAYBE_BASELINK_FUNCTIONS & lkp_iterator. * class.c (deduce_noexcept_on_destructors): Use ovl_iterator. (type_has_user_nondefault_constructor, in_class_defaulted_default_constructor, type_has_user_provided_constructor, type_has_user_provided_or_explicit_constructor, type_has_non_user_provided_default_constructor, vbase_has_user_provided_move_assign, type_has_move_constructor, type_has_move_assign, type_has_user_declared_move_constructor, type_has_user_declared_move_assign, type_build_ctor_call, type_build_dtor_call, type_requires_array_cookie, explain_non_literal_class): Likewise. (finish_struct): Use lkp_iterator. (resolve_address_of_overloaded_function): Use OVL_NAME, lkp_iterator. (note_name_declared_in_class): Use OVL_NAME. * cxx-pretty-print.c (pp_cxx_unqualified_id): Use OVL_FIRST. (pp_cxx_qualified_id, cxx_pretty_printer::id_expression, cxx_pretty_printer::expression): Likewise. * decl2.c (check_classfn): Use ovl_iterator. * pt.c (retrieve_specialization): Use ovl_iterator. * tree.c (cp_tree_equal): Use lkp_iterator. (type_has_nontrivial_copy_init): Use ovl_iterator. * typeck2.c (cxx_incomplete_type_diagnostic): Revert change and check is_overloaded_fn. 2017-05-16 Martin Liska * parser.c (cp_lexer_print_token): Add default value for flags argument of print_gimple_stmt, print_gimple_expr, print_generic_stmt and print_generic_expr. 2017-05-16 Nathan Sidwell * cp-tree.h (class ovl_iterator, class lkp_iterator): New OVERLOAD iterators. (MAYBE_BASELINK_FUNCTIONS): New. * constraint.cc (resolve_constraint_check): Use lkp_iterator. * decl2.c (maybe_warn_sized_delete): Use ovl_iterator. * lambda.c (maybe_generic_this_capture): Use lkp_iterator. * method.c (inherited_ctor_binfo): Use ovl_iterator. (binfo_inherited_from): Likewise. * parser.c (lookup_literal_operator): Use lkp_iterator. * pt.c (iterative_hash_template_arg): Use lkp_iterator. (print_candidates_1): Likewise. (determine_specialization): Likewise. (resolve_overloaded_unification): Likewise. (resolve_nondeduced_context): Likewise. (type_dependent_expression_p): Likewise. (dependent_template_p): Likewise. * ptree.c (cxx_print_xnode): Likewise. * semantics.c (omp_reduction_lookup): Use lkp_iterator. (classtype_has_nothrow_assign_or_copy_p): Use ovl_iterator. * typeck.c (check_template_keyword): Use lkp_iterator. * cp-tree.h (OVL_FIRST, OVL_NAME): New. (ovl_first): New. * constexpr.c (function_concept_check): Use OVL_FIRST. * cvt.c (build_expr_type_conversion): Likewise. * decl.c (poplevel, grokdeclarator): Use OVL_NAME. * decl2.c (mark_used): Use OVL_FIRST. * error.c (dump_decl): Use OVL_FIRST, OVL_NAME. (dump_expr, location_of): Use OVL_FIRST. * friend.c (do_friend): Use OVL_NAME. * init.c (build_offset_ref): Use OVL_FIRST. * mangle.c (write_member_name): Likewise. (write_expression): Use OVL_NAME. * method.c (strip_inheriting_ctors): Use OVL_FIRST. * name-lookup.c (pushdecl_class_level): Use OVL_NAME. * pt.c (check_explicit_specialization): Use OVL_FIRST. (check_template_shadow): Likewise. (tsubst_template_args): Use OVL_NAME. (tsubst_baselink): Use OVL_FIRST. * semantics.c (perform_koenig_lookup): Use OVL_NAME. * tree.c (get_first_fn): Use OVL_FIRST. * typeck.c (finish_class_member_access_expr): Use OVL_NAME. (cp_build_addr_expr_1): Use OVL_FIRST. * pt.c (tsubst_copy_and_build): Remove unnecessary COMPONENT_REF peeking. * semantics.c (finish_id_expression): Directly init local var. (finish_omp_reduction_clause): Use really_overloaded_fn. * tree.c (get_fns): Document. Assert we got an overload. (get_first_fn) Document. * typeck.c (cp_build_addr_expr_1): Pass arg directly to really_overloaded_fn. * typeck2.c (cxx_incomplete_type_diagnostic): Use get_first_fn directly. * cp-tree.h (SCOPE_DEPTH): New. * name-lookup.h (is_nested_namespace): Declare. * name-lookup.c (is_nested_namespace): New. (is_ancestor): Use it. (set_decl_namespace): Likewise. (push_namespace): Set SCOPE_DEPTH. * pt.c (check_specialization_namespace): Use is_nested_namespace. (check_unqualigied_spec_or_inst): Likewise. 2017-05-15 Nathan Sidwell PR c++/79369 * cp-tree.h (DECL_NAMESPACE_INLINE_P): New. * name-lookup.h (push_namespace): Return int, add make_inline arg. * name-lookup.c (push_namespace): Deal with inline directly. Return pushed count. * parser.c (cp_parser_namespace_definition): Adjust for push_namespace change. 2017-05-11 Nathan Sidwell * cp-lang.c (get_global_decls, cxx_pushdecl, LANG_HOOK_GETDECLS, LANG_HOOKS_PUSHDECL): Move to ... * cp-objcp-common.c (cp_get_global_decls, cp_pushdec, LANG_HOOK_DECLS, LANG_HOOKS_PUSHDECL): ... here. * cp-objcp-common.h (cp_get_global_decls, cp_pushdecl): Declare. * name-lookup.h (pushdecl): Add default friend parm. (pushdecl_maybe_friend): Delete. (pushdecl_top_level): Add default friend parm. (pushdecl_top_level_maybe_friend): Delete. * name-lookup.c (pushdecl_maybe_friend): Delete. (pushdecl): Add is_friend parm. (pushdecl_top_level): Add is friend_parm. (pushdecl_top_level_maybe_friend, pushdecl_top_level_1): Delete. (pushdecl_top_level_and_finish): Do pushing and finishing directly. * friend.c (do_friend): Adjust. * pt.c (tsubst_friend_class): Adjust. Revert pushdecl_top_level_and_finish name change. * name-lookup.h (pushdecl_top_level_and_finish): Resurrect old name. * name-lookup.c (pushdecl_top_level_and_finish): Likewise. * decl.c (cp_make_fname_decl): Adjust. * decl2.c (get_guard, handle_tls_init): Adjust. * rtti.c (get_tinfo_decl, tinfo_base_init): Adjust. * name-lookup.c (pushdecl_outermost_localscope): Always conditionally stop timer. * decl.c (xref_tag_1): Don't frob ts_lambda scope here. * name-lookup.c (pushtag_1): Deal with ts_lambda scope. * cp-tree.h (pushdecl, pushdecl_maybe_friend, pushtag, pushtag_top_level_maybe_friend, pushdecl_top_level_and_finish): Move declarations to ... * name-lookup.h: ... here. Group pushdecl variants. (pushdecl_top_level_and_finish): Rename to ... (pushdecl_top_level_with_init): ... here. * decl.c (cp_make_fname_decl): Use pushdecl_top_level_with_init. * decl2.c (get_guard, handle_tls_init): Likewise. * rtti.c (get_tinfo_decl, tinfo_base_init): Likewise. * lambda.c (maybe_add_lambda_conv_op): Use namespace_bindings_p. * method.c (implicitly_declare_fn): Likewise. * searchc (node_debug_info_needed): Likewise. * name-lookup.c (pushdecl_top_level_and_finish): Rename to ... (pushdecl_top_level_with_init): ... here. (pop_everything): Use namespace_bindings_p. * name-lookup.h (pop_binding): Rename to pop_local_binding. (getdecls): Rename to get_local_decls. * name-lookup.c (pop_binding): Rename to ... (pop_local_binding): ... here. (pop_bindings_and_leave_scope): Adjust. (getdecls): Rename to ... (get_local_decls): ... here. Assert local scope. * decl.c (poplevel): Assert not namespace. Adjust and simplify logic. (store_parm_decls): Adjust get_local_decls call. (parser.c (synthesize_implicit_template_parm): Likewise. 2017-05-11 Ville Voutilainen PR c++/80682 * method.c (is_trivially_xible): Reject void types. 2017-05-10 Nathan Sidwell * class.c (handle_using_decl): Always use OVL_CURRENT. (resolve_address_of_overloaded_function): Move iterator decl into for scope. Don't strip anticipated decls here. * pt.c (print_candidates_1): Separate TREE_LIST and OVERLOAD printing. (print_candidates): Adjust. * cp-tree.h (build_new_function_call): Lose koenig_p arg. Fix line breaking. * call.c (build_new_function_call): Lose koenig_p arg. Remove koenig_p handling here. * pt.c (push_template_decl_real): Unconditionally retrofit_lang_decl. (tsubst_omp_clauses): Likewise. (do_class_deduction): Adjust buld_new_function_call calls. * semantics.c (finish_call_expr): Likewise. 2017-05-10 Jason Merrill * pt.c (unify_parameter_deduction_failure, unify_cv_qual_mismatch) (unify_type_mismatch, unify_parameter_pack_mismatch) (unify_ptrmem_cst_mismatch, unify_expression_unequal) (unify_parameter_pack_inconsistent, unify_inconsistency) (unify_vla_arg, unify_method_type_error, unify_arity) (unify_arg_conversion, unify_no_common_base) (unify_inconsistent_template_template_parameters) (unify_template_deduction_failure) (unify_template_argument_mismatch) (unify_overload_resolution_failure): Call unify_invalid. CWG 1847 - Clarifying compatibility during partial ordering * pt.c (more_specialized_fn): No order between two non-deducible parameters. * pt.c (dependent_type_p): Make sure we aren't called with global_type_node. PR c++/79549 - C++17 ICE with non-type auto template parameter pack * pt.c (convert_template_argument): Just return an argument pack. (coerce_template_parameter_pack, template_parm_to_arg) (extract_fnparm_pack, make_argument_pack, tsubst_template_args) (tsubst_decl, tsubst, type_unification_real, unify_pack_expansion): Don't set the type of a NONTYPE_ARGUMENT_PACK. * parser.c (make_char_string_pack, make_string_pack): Likewise. 2017-05-10 Nathan Sidwell * cp-tree.h (add_method, clone_function_decl): Change last arg to bool. * class.c (add_method): Change third arg to bool. Adjust. (one_inheriting_sig, one_inherited_ctor): Adjust. (clone_function_decl): Change 2nd arg to bool. Adjust. (clone_constructors_and_destructors): Adjust. * lambda.c (maybe_add_lambda_conv_op): Adjust. * method.c (lazily_declare_fn): Adjust. * pt.c (tsubst_decl, instantiate_template_1): Adjust. * semantics.c (finish_member_declaration): Adjust. 2017-05-10 Paolo Carlini PR c++/80145 * decl.c (finish_function): To improve error recovery, change the logic for calling apply_deduced_return_type. 2017-05-09 Jason Merrill PR c++/80605 - __is_standard_layout and empty base * class.c (check_bases): Ignore empty bases. PR c++/70979 - literal class and closure types * class.c (finalize_literal_type_property): Handle closures specifically. (explain_non_literal_class): Likewise. PR c++/66297, DR 1684 - literal class and constexpr member fns * constexpr.c (is_valid_constexpr_fn): Only complain about non-literal enclosing class in C++11. * class.c (finalize_literal_type_property): Likewise. 2017-05-09 Paolo Carlini PR c++/80186 * pt.c (tsubst_decl): Early return error_mark_node if grok_ctor_properties returns false. 2017-05-09 Jason Merrill PR c++/70167 - array prvalue treated as lvalue * cp-tree.h (CONSTRUCTOR_C99_COMPOUND_LITERAL): New. (enum fcl_t): New. * semantics.c (finish_compound_literal): Add fcl_context parameter. Only make a static variable for C99 syntax. * parser.c (cp_parser_postfix_expression): Pass it. * pt.c (tsubst_copy_and_build): Likewise. * call.c (extend_ref_init_temps): Set DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. 2017-05-09 Nathan Sidwell * cp-lang.c (get_global_decls, cxx_pushdecl): New. (LANG_HOOKS_GETDECLS, LANG_HOOKS_PUSHDECL): Override. * name-lookup.h (pushdecl_top_level): Declare. 2017-05-08 Jason Merrill PR c++/80178 - parameter passing for uncopyable classes * tree.c (type_has_nontrivial_copy_init): True for classes with only deleted copy/move ctors. (remember_deleted_copy, maybe_warn_parm_abi): New. * decl.c (require_complete_types_for_parms, check_function_type): Call maybe_warn_parm_abi. * call.c (convert_for_arg_passing, build_cxx_call): Likewise. 2017-05-08 Nathan Sidwell * decl.c (builtin_function_1): Set DECL_ANTICIPATED before pushing. (start_preparsed_function): Do decl pushing before setting current_funciton_decl and announcing it. * name-lookup.h (pushdecl_with_scope): Replace with ... (pushdecl_outermost_localscope): ... this. * name-lookup.c (pushdecl_with_scope): Replace with ... (pushdecl_outermost_localscope): ... this. (pushdecl_namespace_level): Adjust. * decl.c (cp_make_fname_decl): Use pushdecl_outermost_localscope. * lambda.c (insert_capture_proxy): Likewise. * class.c (build_vtbl_initializer): Don't shadow outer variable with static var. Revert _binding -> _value change. * name-lookup.h (get_namespace_value, set_global_value): Rename to ... (get_namespace_binding, set_global_binding): ... these. * name-lookup.c (get_namespace_value, set_global_value): Rename to ... (get_namespace_binding, set_global_binding): ... these. (arg_assoc_namespace, pushdecl_maybe_friend_1, check_for_out_of_scope_variable, push_overloaded_decl_1, lookup_name_innermost_nonclass_level, push_namespace): Adjust. * cp-tree.h (IDENTIFIER_GLOBAL_VALUE, SET_IDENTIFIER_GLOBAL_VALUE): Adjust. * decl.c (poplevel): Adjust. * pt.c (make_constrained_auto): Likewise. 2017-05-07 Volker Reichelt PR translation/80280 * call.c (print_z_candidate): Fix quoting. 2017-05-05 David Malcolm * error.c (pedwarn_cxx98): Replace report_diagnostic with diagnostic_report_diagnostic. 2017-05-05 Nathan Sidwell * cp-tree.h (IDENTIFIER_GLOBAL_VALUE): Use get_namespace_value. (SET_IDENTIFIER_GLOBAL_VALUE): Use set_global_value. (IDENTIFIER_NAMESPACE_VALUE): Delete. * name-lookup.h (namespace_binding, set_namespace_binding): Replace with ... (get_namespace_value, set_global_value): ... these. (get_global_value_if_present, is_typename_at_global_scope): Delete. * decl.c (poplevel): Use get_namespace_value. (grokdeclarator): Use IDENTIFIER_GLOBAL_VALUE. * class.c (build_vtbl_initializer): Stash library decl in static var. Use IDENTIFIER_GLOBAL_VALUE. * except.c (do_get_exception_ptr, do_begin_catch, do_end_catch, do_allocate_exception, do_free_exception, build_throw): Likewise. * init.c (throw_bad_array_new_length): Likewise. * rtti.c (throw_bad_cast, throw_bad_typeid): Likewise. * name-lookup.c (arg_assoc_namespace, pushdecl_maybe_friend_1, check_for_our_of_scope_variable, push_overloaded_decl_1): Use get_namespace_value. (set_namespace_binding_1): Rename to (set_namespace_binding): ... here. (set_global_value): New. (lookup_name_innermost_nonclass_level_1, push_namespace): Use get_namespace_value. * pt.c (listify): Use get_namespace_value. * call.c (make_temporary_var_for_ref_to_temp): Push decl into current scope. * lex.c (unqualified_name_lookup_error): Likewise. * class.c (alter_class): Use retrofit_lang_decl directly. * decl.c (push_local_name, dupliate_decls): Likewise. * semantics.c (omp_privatize_field): Likewise. Kill walk_namespaces. * cp-tree.h (walk_namespaces_fn, walk_namespaces): Delete. * decl.c (walk_namespaces_r, walk_namespaces): Delete. Kill per-namespace static_decls. * cp-tree.h (static_decls): Declare. (wrapup_globals_for_namespace, diagnose_inline_vars_for_namespace): Replace with ... (wrapup_namespace_globals): ... this. * decl.c (static_decls): Define. (wrapup_globals_for_namespace, diagnose_inline_vars_for_namespace): Replace with ... (wrapup_namespace_globals): ... this. (cxx_init_decl_processing): Initialize static_decls. * decl2.c (c_parse_final_cleanups): Adjust. * name-lookup.h (cp_binding_level): Remove static_decls member. * name-lookup.c (add_decl_to_level): Adjust. (begin_scope): Adjust. 2017-05-05 Paolo Carlini PR c++/71577 * decl.c (reshape_init): Unconditionally return error_mark_node upon error about too many initializers. 2017-05-04 Nathan Sidwell * constraint.cc (diagnose_check_constraint): Fix %E thinko. 2017-05-04 Martin Sebor PR translation/80280 * call.c (print_z_candidate): Add missing quoting to %D and other like directives. (build_op_call_1): Same. * constraint.cc (diagnose_check_constraint): Same. * mangle.c (mangle_decl): Same. * name-lookup.c (cp_binding_level_debug): Same. (set_decl_namespace): Same. * parser.c (cp_parser_tx_qualifier_opt): Same. * pt.c (print_candidates_1): Same. (check_template_variable): Same. (tsubst_default_argument): Same. (most_specialized_partial_spec): Same. * semantics.c (omp_reduction_lookup): Same. * tree.c (check_abi_tag_redeclaration): Same. * typeck.c (comptypes): Same. * typeck2.c (abstract_virtuals_error_sfinae): Same. 2017-05-04 Nathan Sidwell More global trees. * cp-tree.h (enum cp_tree_index): Add CPTI_GLOBAL, CPTI_GLOBAL_TYPE, CPTI_GLOBAL_IDENTIFIER, CPTI_ANON_IDENTIFIER, CPTI_INIT_LIST_IDENTIFIER. (global_namespace, global_type_node, global_identifier, anon_identifier, init_list_identifier): New. * decl.c (global_type_node, global_scope_name): Delete. (initialize_predefined_identifiers): Add new identifiers. (cxx_init_decl_processing): Adjust. * name-lookup.h (global_namespace, global_type_node): Delete. * name-lookup.c (global_namespace, anonymous_namespace_name, get_anonymous_namespace_name): Delete. (namespace_scope_ht_size, begin_scope, pushtag_1, push_namespace): Adjust, * call.c (type_has_extended_temps): Use init_list_identifier. * pt.c (listify): Likewise. * name-lookup.c: Reorder functions to make merging from modules branch simpler. 2017-05-03 Jason Merrill * constexpr.c (cxx_eval_outermost_constant_expr): Use TV_CONSTEXPR. 2017-05-03 Nathan Sidwell * cp-tree.h (enum cp_tree_index, cp_global_trees): Move earlier, along with #defines, to before name-lookup include. 2017-05-02 Paolo Carlini * pt.c (is_auto_or_concept): Remove. (type_uses_auto_or_concept): Remove, unused. (find_parameter_packs_r, extract_autos_r, is_auto_r): Adjust. * parser.c (tree_type_is_auto_or_concept): Remove, unused. * cp-tree.h (is_auto_or_concept): Remove. 2017-05-01 Xi Ruoyao PR c++/80038 * cp-cilkplus.c (cilk_install_body_with_frame_cleanup): Don't add pedigree operation and detach call here. * cp-gimplify.c (cp_gimplify_expr): Remove the calls to cilk_cp_gimplify_call_params_in_spawned_fn. (cilk_cp_gimplify_call_params_in_spawned_fn): Remove function. * semantics.c (simplify_aggr_init_expr): Copy EXPR_CILK_SPAWN. 2017-04-29 Volker Reichelt * parser.c (cp_parser_member_declaration): Add fix-it hints for stray comma and missing semicolon at end of member declaration. 2017-04-27 Volker Reichelt * parser.c (cp_parser_cast_expression): Add target type of cast to diagnostic. * error.c (type_to_string): Add '{enum}' suffix to enumeration types. 2017-04-26 Paolo Carlini * decl.c (grok_ctor_properties, ambi_op_p, unary_op_p): Change return type to bool. * cp-tree.h (grok_ctor_properties): Update. 2017-04-26 Volker Reichelt * parser.c (cp_parser_nested_name_specifier_opt): Add fix-it information to diagnostic of invalid colon in nested-name-specifier. 2017-04-25 Volker Reichelt * parser.c (cp_parser_elaborated_type_specifier): Add fix-it to diagnostic of invalid class/struct keyword after enum. 2017-04-25 David Malcolm * parser.c (cp_parser_member_declaration): Add fix-it hint for removing stray semicolons. 2017-04-25 David Malcolm * name-lookup.c (get_std_name_hint): New function. (maybe_suggest_missing_header): New function. (suggest_alternative_in_explicit_scope): Call maybe_suggest_missing_header. 2017-04-25 David Malcolm PR c++/80177 * name-lookup.c (suggest_alternative_in_explicit_scope): Convert candidate type of bm from tree to const char *. (consider_binding_level): Likewise. (lookup_name_fuzzy): Likewise, using this to merge the best result from the preprocessor into bm, rather than immediately returning, so that better matches from reserved words can "win". Guard the rejection of keywords that don't start decl-specifiers so it only happens for FUZZY_LOOKUP_TYPENAME. 2017-04-24 Volker Reichelt * decl.c (grokdeclarator): Use %qT instead of %<%T%> in diagnostics. (start_enum): Likewise. (build_enumerator): Likewise. Use %qE instead of plain %E. * parser.c (cp_parser_mem_initializer_list): Use %qD instead of %<%D%> in diagnostics. (cp_parser_elaborated_type_specifier): Likewise. * pt.c (make_pack_expansion): Use %qT and %qE instead of %<%T%> and %<%E%> in diagnostics. (tsubst_pack_expansion): Likewise. 2017-04-24 David Malcolm PR c++/80016 * parser.c (cp_parser_unary_expression): Generate a location range for alignof and sizeof expressions. 2017-04-24 Volker Reichelt * parser.c (cp_parser_cv_qualifier_seq_opt): Add fix-it info to error message. (cp_parser_virt_specifier_seq_opt): Likewise. (set_and_check_decl_spec_loc): Likewise twice. 2017-04-21 Jason Merrill PR c++/80179 - ICE with initialized flexible array member. * constexpr.c (verify_ctor_sanity): Handle flexible array members. 2017-04-21 Richard Biener * cp-tree.h (copy_decl): Annotate with CXX_MEM_STAT_INFO. (copy_type): Likewise. * lex.c (copy_decl): Pass down mem-stat info. (copy_type): Likewise. 2017-04-20 Jonathan Wakely PR c++/80473 * init.c (build_new_1): Suppress notes about over-aligned new when the warning is suppressed. 2017-04-20 Volker Reichelt * parser.c (cp_parser_member_declaration): Add warning with fixit information for extra semicolon after in-class function definition. 2017-04-20 Jakub Jelinek PR middle-end/80423 * tree.c (build_cplus_array_type): Call build_array_type with the intended TYPE_TYPELESS_STORAGE flag value, instead of calling build_array_type and modifying later TYPE_TYPELESS_STORAGE on the shared type. 2017-04-18 Marek Polacek PR c++/80244 - ICE with attribute in template alias. * tree.c (strip_typedefs): Handle UNDERLYING_TYPE. PR c++/80241 - ICE with alignas pack expansion. * error.c (dump_expr): Handle TREE_LIST. * parser.c (cp_parser_std_attribute_list): Return error_mark if make_pack_expansion returns an error. 2017-04-17 Bernd Edlinger PR c++/80287 * class.c (fixup_may_alias): Fix all type variants. 2017-04-17 Jason Merrill PR c++/80415 - wrong error with default arg and array reference. * tree.c (lvalue_kind): Return clk_class for an array prvalue. * pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P. 2017-04-15 Alexandre Oliva * decl.c (name_unnamed_type): Split out of... (grokdeclarator): ... this. * decl.h (name_unnamed_type): Declare. 2017-04-12 Richard Biener Bernd Edlinger PR middle-end/79671 * tree.c (build_cplus_array_type): Set TYPE_TYPELESS_STORAGE for arrays of character or std::byte type. 2017-04-11 Jason Merrill PR c++/80294 - ICE with constexpr and inheritance. * constexpr.c (reduced_constant_expression_p): A null constructor element is non-constant. (cxx_eval_indirect_ref): Don't VERIFY_CONSTANT before returning an empty base. 2017-04-11 Jakub Jelinek PR c++/80370 * decl.c (cp_finish_decomp): If processing_template_decl on non-dependent decl, only set TREE_TYPE on the v[i] decls, but don't change their DECL_VALUE_EXPR nor cp_finish_decl them. Instead make sure DECL_VALUE_EXPR is the canonical NULL type ARRAY_REF for tsubst processing. * pt.c (value_dependent_expression_p) : For variables with DECL_VALUE_EXPR, return true if DECL_VALUE_EXPR is type dependent. 2017-04-11 Jakub Jelinek PR c++/80363 * error.c (dump_expr): Handle VEC_COND_EXPR like COND_EXPR. 2017-04-10 Jakub Jelinek PR c++/80176 * tree.c (lvalue_kind): For COMPONENT_REF with BASELINK second operand, if it is a static member function, recurse on the BASELINK. 2017-04-10 Marek Polacek PR sanitizer/80348 * typeck.c (cp_build_binary_op): Use NULL_TREE instead of NULL. Set ORIG_TYPE earlier and not only when shortening. 2017-04-07 Jason Merrill PR c++/80356 - ICE with reference to function template argument. PR c++/79294 * pt.c (convert_nontype_argument_function): Adjust type even with a value-dependent argument. PR c++/80267 - ICE with nested capture of reference PR c++/60992 * pt.c (tsubst_copy): Handle lookup finding a capture proxy. 2017-04-07 Marek Polacek PR sanitizer/80348 * typeck.c (cp_build_binary_op): Convert COP[01] to ORIG_TYPE. PR c++/80095 * call.c (build_over_call): Don't check cxx_dialect. * cp-gimplify.c (cp_gimplify_init_expr): Don't check cxx_dialect nor whether SUB is a CONSTRUCTOR. * init.c (build_new_1): Don't check cxx_dialect. * tree.c (replace_placeholders): Add a function comment. Return if not in C++14, or if the object isn't a (member of a) class. * typeck2.c (store_init_value): Don't check cxx_dialect nor whether TYPE is CLASS_TYPE_P. 2017-04-05 Jakub Jelinek PR c++/80309 * pt.c (canonical_type_parameter): Use vec_safe_grow_cleared instead of a loop doing vec_safe_push of NULL. Formatting fixes. (rewrite_template_parm): Copy TEMPLATE_PARM_PARAMETER_PACK from oldidx to newidx before calling canonical_type_parameter on newtype. 2017-04-04 Volker Reichelt PR c++/80296 * cxx-pretty-print.c (cxx_pretty_printer::expression): Add UNARY_PLUS_EXPR case. 2017-04-03 Jason Merrill * semantics.c (finish_template_type): Check CLASSTYPE_TEMPLATE_INFO. 2017-04-03 Jonathan Wakely * class.c (update_vtable_entry_for_fn): Fix typo in comment. * decl2.c (one_static_initialization_or_destruction): Likewise. * name-lookup.c (store_bindings): Likewise. * parser.c (make_call_declarator): Likewise. * pt.c (check_explicit_specialization): Likewise. 2017-04-03 Jason Merrill PR sanitizer/79993 - ICE with VLA initialization from string PR c++/69487 - wrong VLA initialization from string * init.c (finish_length_check): Split out from build_vec_init. (build_vec_init): Handle STRING_CST. * typeck2.c (split_nonconstant_init): Handle STRING_CST. (digest_init_r): Don't give a STRING_CST VLA type. 2017-03-31 Jakub Jelinek PR c++/79572 * cp-gimplify.c (cp_genericize_r): Sanitize INTEGER_CSTs with REFERENCE_TYPE. Adjust ubsan_maybe_instrument_reference caller for NOP_EXPR to REFERENCE_TYPE. PR libstdc++/80251 * cp-tree.h (enum cp_trait_kind): Add CPTK_IS_AGGREGATE. * cxx-pretty-print.c (pp_cxx_trait_expression): Handle CPTK_IS_AGGREGATE. * semantics.c (trait_expr_value): Handle CPTK_IS_AGGREGATE. Remove extraneous parens. (finish_trait_expr): Handle CPTK_IS_AGGREGATE. * parser.c (cp_parser_primary_expression): Handle RID_IS_AGGREGATE. (cp_parser_trait_expr): Likewise. 2017-03-27 Jakub Jelinek PR middle-end/80162 * cp-tree.h (cxx_mark_addressable): Add array_ref_p argument. * typeck.c (cxx_mark_addressable): Likewise. Look through VIEW_CONVERT_EXPR unless array_ref_p and VCE is from VECTOR_TYPE to ARRAY_TYPE. (cp_build_array_ref): Pass true as array_ref_p to cxx_mark_addressable. 2017-03-24 Jason Merrill PR c++/77339 - ICE with invalid use of alias template. * pt.c (lookup_template_class_1): Don't try to enter the scope of an alias template. 2017-03-24 Marek Polacek PR c++/80119 * cp-gimplify.c (cp_fold): Strip CLEANUP_POINT_EXPR if the expression doesn't have side effects. 2017-03-23 Jason Merrill PR c++/80150 - ICE with overloaded variadic deduction. * pt.c (try_one_overload): Remove asserts. PR c++/77563 - missing ambiguous conversion error. * call.c (convert_like_real): Use LOOKUP_IMPLICIT. 2017-03-23 Marek Polacek * cp-tree.h: Remove a C_RID_YYCODE reference. 2017-03-22 Jakub Jelinek PR c++/80141 * semantics.c (finish_omp_clause) : Call maybe_constant_value only when not processing_template_decl. 2017-03-21 Paolo Carlini PR c++/77752 * name-lookup.c (pushtag_1): Add check for bogus, non template, std::initializer_list. 2017-03-21 Jakub Jelinek PR c++/35878 * init.c (std_placement_new_fn_p, build_new_1): Formatting fixes. 2017-03-21 Ville Voutilainen PR c++/35878 * init.c (std_placement_new_fn_p): New. (build_new_1): Call it. 2017-03-20 Jason Merrill PR c++/80096 - ICE with C++17 non-type auto. * pt.c (tsubst): Delay tsubst of type of template non-type parameter. PR c++/79519 - ICE with deleted template friend. * decl.c (grokdeclarator): Complain about misplaced function definition using =, as well. PR c++/79640 - infinite recursion with generic lambda. * pt.c (tsubst_copy) [VAR_DECL]: Register the dummy instantiation before substituting its initializer. 2017-03-20 Marek Polacek Paolo Carlini PR c++/80059 - ICE with noexcept and __transaction_atomic * except.c (build_must_not_throw_expr): Call instantiate_non_dependent_expr. 2017-03-19 Jason Merrill PR c++/80084 - wrong C++17 decomposition by reference of parameter. * decl.c (cp_finish_decomp): Don't pull out the DECL_INITIAL of a reference decomposition. PR c++/80077 - error with constexpr and -fno-elide-constructors. * constexpr.c (cxx_eval_call_expression): Set ctx->call while expanding trivial constructor. 2017-03-17 Jason Merrill PR c++/78345 - ICE initializing array from lambda. * init.c (build_aggr_init): Check array initializer. (build_vec_init): Check the type of a CONSTRUCTOR. PR c++/80073 - C++17 ICE with virtual base. * decl.c (xref_basetypes): Also check for indirect vbases. 2017-03-16 Jason Merrill * decl.c (start_enum): std::byte aliases anything. PR c++/79797 * constexpr.c (lookup_placeholder): Tweak. 2017-03-15 Jason Merrill PR c++/80043 - ICE with -fpermissive * typeck.c (convert_for_assignment): Handle instantiate_type not giving an error. 2017-03-14 Nathan Sidwell PR c++/79393 DR 1658 workaround * method.c (synthesized_method_base_walk): Inihibit abstract class virtual base access check here. (synthesized_method_walk): Not here. 2017-03-13 Nathan Sidwell PR c++/79393 DR 1658 workaround * method.c (synthesized_method_walk): Check vbases of abstract classes for dtor walk. 2017-03-10 David Malcolm PR translation/79848 * decl.c (grokfndecl): Simplify uses of "%<%s%>" to "%qs". 2017-03-10 Jason Merrill PR c++/79960 - alias templates and partial ordering * pt.c (comp_template_args): Add partial_order parm. (template_args_equal): Likewise. (comp_template_args_porder): New. (get_partial_spec_bindings): Use it. 2017-03-10 Marek Polacek PR c++/79967 * decl.c (grokdeclarator): Check ATTRLIST before dereferencing it. 2017-03-10 Jakub Jelinek PR c++/79899 * optimize.c (maybe_thunk_body): Don't ICE if fns[0] is NULL. Use XALLOCAVEC macro. PR c++/79896 * decl.c (finish_enum_value_list): If value is error_mark_node, don't copy it and change its type. * init.c (constant_value_1): Return error_mark_node if DECL_INITIAL of CONST_DECL is error_mark_node. 2017-03-09 Marek Polacek PR c++/79900 - ICE in strip_typedefs * tree.c (strip_typedefs): Skip the attribute handling if T is a variant type which hasn't been updated yet. PR c++/79687 - wrong code with pointer-to-member * init.c (constant_value_1): Break if the variable has a dynamic initializer. 2017-03-08 Jason Merrill PR c++/79797 - ICE with self-reference in array DMI. * constexpr.c (lookup_placeholder): Split out... (cxx_eval_constant_expression): ...from here. 2017-03-07 Jakub Jelinek PR c/79834 * parser.c (cp_parser_omp_cancellation_point, cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data, cp_parser_omp_target_update): Change "may only be used in compound statements" diagnostics, such that the same translatable string is used for all pragmas. (cp_parser_pragma): Likewise. Use error_at instead of cp_parser_error for that diagnostics. 2017-03-06 Marek Polacek PR c++/79796 - ICE with NSDMI and this pointer * call.c (build_over_call): Handle NSDMI with a 'this' by calling replace_placeholders. 2017-03-06 Jakub Jelinek PR c++/79822 * constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like ({ (void) 0; }). 2017-03-06 Jason Merrill Revert "Allow deduction guides to look into primary template." * cp-tree.h, parser.c, pt.c, search.c: Revert. 2017-03-05 Paolo Carlini PR c++/70266 * except.c (build_must_not_throw_expr): Perform the implicit conversions on the condition. 2017-03-03 Jason Merrill * mangle.c (mangle_decl): Check -Wnoexcept-type instead of -Wc++1z-compat. Core issues 2273 and 2277 * call.c (joust): Adjust using-declaration tiebreaker to handle the intermediate base case. * method.c (strip_inheriting_ctors): Just return the argument if !flag_new_inheriting_ctors. 2017-03-03 Richard Biener PR c++/79825 * cp-gimplify.c (simple_empty_class_p): Handle EMPTY_CLASS_EXPR. 2017-03-03 Marek Polacek PR c++/79791 * typeck.c (string_conv_p): In C++11, always call pedwarn with OPT_Wwrite_strings. 2017-03-02 Jason Merrill Update overload resolution with deduction guides. * pt.c (do_class_deduction): Always build the copy guide. (copy_guide_p, template_guide_p): New. (build_deduction_guide): Remember the original constructor. * call.c (joust): Prefer the copy guide and non-template guides. Allow deduction guides to look into primary template. * cp-tree.h (struct saved_scope): Add deduction_guide_type. (struct cp_decl_specifier_seq): Add constructor_p. * parser.c (cp_parser_decl_specifier_seq): Set constructor_p. (cp_parser_init_declarator): Check it. Set ctor_dtor_or_conv_p. Clear deduction_guide_type. Don't handle deduction guide names. (cp_parser_declarator): Don't clear ctor_dtor_or_conv_p. (cp_parser_direct_declarator): Likewise. Handle deduction guides. (cp_parser_member_declaration, cp_parser_cache_defarg) (cp_parser_objc_class_ivars): Set ctor_dtor_or_conv_p. * pt.c (tsubst_copy, tsubst_copy_and_build): Revert last change. (build_deduction_guide): Set deduction_guide_type. (dependent_scope_p): Check deduction_guide_type. * search.c (lookup_member): Likewise. 2017-03-02 Jakub Jelinek PR c++/79782 * init.c (mark_exp_read_r): New function. (emit_mem_initializers): Use cp_walk_tree with mark_exp_read_r on whole arguments instead of plain mark_exp_read on TREE_LIST values. 2017-03-01 Jason Merrill Class template argument deduction in new-expression * init.c (build_new): Handle deduction from no initializer. * parser.c (cp_parser_new_expression): Don't require a single expression for class template deduction. * typeck2.c (cxx_incomplete_type_diagnostic): Fix diagnostic for class template placeholder. * pt.c (tsubst_copy) [TEMPLATE_DECL]: Handle dependent context. (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle SCOPE_REF. (redeclare_class_template): Set TEMPLATE_TYPE_PARM_FOR_CLASS. 2017-03-01 Jakub Jelinek PR c++/79746 * init.c (emit_mem_initializers): When not constructing vbases of abstract classes, mark arguments as read for -Wunused-but-set-parameter. 2017-02-28 Jason Merrill Class template argument deduction refinements * call.c (joust): Move deduction guide tiebreaker down. * decl.c (start_decl_1, cp_finish_decl, grokdeclarator): Allow class deduction with no initializer. * pt.c (build_deduction_guide): Handle implicit default/copy ctor. (do_class_deduction): Use that rather than special case. (do_auto_deduction): Handle null initializer. 2017-02-28 Jakub Jelinek * decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...") instead of just cond ? "..." : "...". (grokdeclarator): Likewise. (build_enumerator): Likewise. * init.c (build_new_1): Likewise. * call.c (build_new_method_call_1): Likewise. * parser.c: Include intl.h. (cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for "enter"/"exit" keyword. (cp_finalize_oacc_routine): Don't use %s to supply portions of the message. 2017-02-27 Jason Merrill PR c++/71568 - SFINAE forming pointer to member function * init.c (build_offset_ref): Check the return value of perform_or_defer_access_check. 2017-02-27 Marek Polacek * decl.c (expand_static_init): Add missing } in a comment. 2017-02-27 Volker Reichelt * init.c: Include intl.h. (build_new_1): Move message strings into pedwarn to make them -Wformat-security friendly. Mark string for translation. * pt.c (tsubst_copy_and_build): Mark string for translation. Make the pointer const. * semantics.c (finish_id_expression): Mark strings for translation. 2017-02-25 Jakub Jelinek * call.c (build_op_delete_call): Make msg1 and msg2 const. 2017-02-24 Jakub Jelinek PR c++/79588 * call.c (build_over_call): Call check_function_arguments even for -Wrestrict, adjust check_function_arguments caller. * parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict here. * typeck.c (cp_build_function_call_vec): Adjust check_function_arguments caller. 2017-02-24 Marek Polacek PR translation/79705 * decl.c (check_redeclaration_exception_specification): Mark a string for translation. Make the pointer const. 2017-02-23 Paolo Carlini PR c++/79361 * pt.c (register_specialization): Check duplicate_decls return value for error_mark_node and pass it back. 2017-02-22 Jason Merrill PR c++/79679 - missing destructor for argument * call.c (build_over_call): Don't pass tf_no_cleanup to argument conversions. * pt.c (do_class_deduction): Handle 0 argument case. 2017-02-22 Jakub Jelinek PR c++/79664 * parser.c (cp_parser_omp_teams, cp_parser_omp_target): Use SET_EXPR_LOCATION on OMP_TARGET/OMP_TEAMS tree. * constexpr.c (potential_constant_expression_1): Handle OMP_*, OACC_* and CILK_* trees. Use error_at with EXPR_LOC_OR_LOC (t, input_location) computed early instead of error, or error_at with location_of (t). 2017-02-22 Marek Polacek PR c++/79653 * parser.c (cp_parser_std_attribute_spec): Don't build the attribute if the alignas expression is erroneous. * pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return error_mark_node. PR c++/79657 * semantics.c (finish_underlying_type): Bail out for incomplete enums. 2017-02-21 Jason Merrill PR c++/50308 - wrong deprecated warning with ADL PR c++/17729 - duplicate deprecated warning * semantics.c (finish_id_expression): Only call mark_used on a function if we aren't building a call. PR c++/41727 - ICE with partial spec of partial instantiation * pt.c (process_partial_specialization): For now, don't check more specialized if there is more than one level of args. 2017-02-21 Marek Polacek PR c++/79535 * cp-tree.h (maybe_reject_flexarray_init): Declare. * init.c (maybe_reject_flexarray_init): No longer static. Add check for current_function_decl. * parser.c (cp_parser_late_parse_one_default_arg): Reject a default mem-initializer for a flexible array. 2017-02-21 Jakub Jelinek Paolo Carlini PR c++/79654 * decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node on error. * pt.c (tsubst_decomp_names): Return error_mark_node if the first decl after the decomposition artificial decl has error_mark_node. * decl2.c (prune_vars_needing_no_initialization): Use error_operand_p instead of just == error_mark_node comparison. 2017-02-21 Jakub Jelinek PR sanitizer/79589 * decl.c: Include gimplify.h. (cp_finish_decomp): Make sure there is no sharing of trees in between DECL_VALUE_EXPR of decomposition decls. PR c++/79655 * constexpr.c (cxx_eval_array_reference): Diagnose negative subscript. PR c++/79639 * constexpr.c (cxx_eval_store_expression): If *valp is a PTRMEM_CST, call cplus_expand_constant on it first. 2017-02-19 Jason Merrill PR c++/78139 - destructor needed by new-expression * call.c (build_special_member_call): Use tf_no_cleanup. PR c++/78282 - auto template and pack expansion * pt.c (find_parameter_packs_r): Don't walk into the type of templates other than template template-parameters. PR c++/79606 - ICE with this->base_member in NSDMI * class.c (build_base_path): Check processing_template_decl. PR c++/79607 - ICE with T{} initializer * decl.c (type_dependent_init_p): Check the type of a CONSTRUCTOR. PR c++/79566 - elaborated-type-specifier in range for * parser.c (cp_parser_simple_declaration): Fix check for type definition. PR c++/79400 - confusing suggestion of 'noexcept' * parser.c (cp_parser_exception_specification_opt): Remove suggestion for deprecated dynamic exception-specification. PR c++/79470 - partial ordering with reference parameters * pt.c (unify) [INDIRECT_REF]: Handle pack expansions. PR c++/79500 - ICE with non-template deduction guide * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than DECL_TEMPLATE_RESULT. PR c++/79580 - ICE with compound literal * parser.c (cp_parser_class_head): If we're in the middle of an expression, use ts_within_enclosing_non_class. PR c++/79503 - inherited ctor taking base class * call.c (add_function_candidate): Also check that DECL_INHERITED_CTOR_BASE is reference-related to the parameter type. 2017-02-19 Paolo Carlini PR c++/79380 * typeck.c (cxx_alignas_expr): Reject a non-integral alignas argument. 2017-02-19 Eric Fiselier Jonathan Wakely PR c++/69523 * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to control warning about literal suffix identifiers without a leading underscore. 2017-02-17 Jason Merrill PR c++/79508 - lookup error with member template * parser.c (cp_parser_template_name): Clear parser->context->object_type if we aren't doing lookup. PR c++/78690 - ICE with using and global type with same name * pt.c (type_dependent_object_expression_p): True for IDENTIFIER_NODE. PR c++/79549 - C++17 ICE with non-type auto template parameter pack * pt.c (convert_template_argument): Just return an auto arg pack. (tsubst_template_args): Don't tsubst an auto pack type. PR c++/79556 - C++17 ICE with non-type auto * pt.c (do_auto_deduction): Don't try to deduce from null type. PR c++/79533 - C++17 ICE with temporary cast to reference * call.c (build_over_call): Conversion to a reference prevents copy elision. 2017-02-16 Jakub Jelinek Jason Merrill PR c++/79502 - lost nodiscard attribute * pt.c (apply_late_template_attributes): Do apply non-dependent attributes to types. 2017-02-16 Jason Merrill PR c++/78572 - ICE with self-modifying array initializer * constexpr.c (cxx_eval_store_expression): The object we're initializing is outside the constant-expression. (cxx_eval_call_expression): Set ctx->call. PR c++/79050 - ICE with undeduced auto and LTO * decl.c (poplevel): Remove undeduced auto decls. 2017-02-16 Jakub Jelinek PR c++/79512 * parser.c (cp_parser_omp_target): For -fopenmp-simd ignore #pragma omp target even when not followed by identifier. 2017-02-15 Jason Merrill Jakub Jelinek PR c++/79464 - ICE in IPA with omitted constructor parms * class.c (build_clone): Also omit parms from TYPE_ARG_TYPES. (adjust_clone_args): Adjust. (add_method): Remember omitted parms. * call.c (add_function_candidate): Likewise. * mangle.c (write_method_parms): Likewise. * method.c (ctor_omit_inherited_parms): Return false if there are no parms to omit. 2017-02-15 Martin Sebor PR c++/79363 * init.c (maybe_reject_flexarray_init): New function. (perform_member_init): Call it. 2017-02-15 Jakub Jelinek PR c++/79301 * parser.c (cp_parser_std_attribute): Don't pedwarn about [[deprecated]] with -std=c++11 and [[fallthrough]] with -std=c++11 and -std=c++14. PR c++/79288 * decl.c (grokdeclarator): For static data members, handle thread_p only after handling inline. 2017-02-14 Marek Polacek PR c++/79420 PR c++/79463 * parser.c (cp_parser_postfix_dot_deref_expression): Avoid clobbering if the postfix expression isn't an EXPR_P. 2017-02-13 Jason Merrill PR c++/79461 - ICE with lambda in constexpr constructor * constexpr.c (build_data_member_initialization): Ignore initialization of a local variable. 2017-02-13 Jakub Jelinek * init.c (warn_placement_new_too_small): Add missing space in diagnostics. * parser.c (cp_parser_oacc_declare): Likewise. * mangle.c (maybe_check_abi_tags): Likewise. PR c++/79232 * typeck.c (cp_build_modify_expr): Handle properly COMPOUND_EXPRs on lhs that have {PRE{DEC,INC}REMENT,MODIFY,MIN,MAX,COND}_EXPR in the rightmost operand. 2017-02-13 Nathan Sidwell PR c++/79296 - ICE mangling localized template instantiation * decl2.c (determine_visibility): Use template fn context for local class instantiations. 2017-02-11 Jason Merrill PR c++/77659 - ICE with new and C++14 aggregate NSDMI * init.c (build_new): Make backups of any CONSTRUCTORs in init. (build_new_1): Use replace_placeholders. * tree.c (replace_placeholders_t): Also track whether we've seen a placeholder. (replace_placeholders, replace_placeholders_r): Adjust. * cp-tree.h: Adjust. PR c++/77790 - ICE with auto function in C++11 mode * decl.c (undeduced_auto_decl): Remove C++14 limitation. (require_deduced_type): Add complain parm, return bool. * cp-tree.h: Adjust. * decl2.c (mark_used): Use require_deduced_type. 2017-02-10 Jason Merrill PR c++/78908 - template ops and bitfields * tree.c (build_min_non_dep): Use unlowered_expr_type. PR c++/78897 - constexpr union * constexpr.c (cxx_eval_store_expression): A store to a union member erases a previous store to another member. PR c++/71285 - member of fold-expression * semantics.c (finish_unary_fold_expr) (finish_binary_fold_expr): Use null type for fold-expressions. PR c++/79401 - protected inherited constructor * call.c (enforce_access): For inheriting constructor, find a base binfo in the path we already have. 2017-02-10 Marek Polacek PR c++/79435 * pt.c (type_dependent_expression_p): Check if the expression type is null. PR c++/79184 * cvt.c (ocp_convert): Add a sentinel against -Wint-in-bool-context if warnings shouldn't be given. 2017-02-10 Paolo Carlini PR c++/71737 * pt.c (tsubst_decl): Don't try to preserve a typedef that names an error_mark_node as type. 2017-02-09 Jakub Jelinek Jason Merrill PR c++/79143 * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE from pattern to type. 2017-02-09 Jason Merrill PR c++/79316 - default argument in deduction guide PR c++/79350 - explicit deduction guide * parser.c (cp_parser_constructor_declarator_p) (cp_parser_direct_declarator): Parse deduction guides more like constructors. * cp-tree.h (enum special_function_kind): Add sfk_deduction_guide. * tree.c (special_function_p): Return it. * decl.c (check_special_function_return_type): Handle it. (grokdeclarator, grokfndecl): Adjust. (cp_finish_decl): Pass flags to do_auto_deduction. * error.c (dump_decl_name): Use TFF_UNQUALIFIED_NAME. * pt.c (dguide_name_p): Take a const_tree. (do_class_deduction): Handle explicit. (do_auto_deduction): Pass flags through. (build_deduction_guide): Copy explicit flag. 2017-02-09 Jakub Jelinek PR c++/79429 * parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt non-pragma_compound context here. (cp_parser_omp_target): Likewise. (cp_parser_pragma): Don't call push_omp_privatization_clauses and parsing for ordered and target omp pragmas in non-pragma_stmt non-pragma_compound contexts. PR c/79431 * parser.c (cp_parser_oacc_declare): Formatting fix. (cp_parser_omp_declare_target): Don't invoke symtab_node::get on automatic variables. 2016-02-09 Nathan Sidwell Chung-Lin Tang * parser.c (cp_parser_oacc_clause_tile): Disallow collapse. Fix parsing. Parse constant expression. Remove semantic checking. (cp_parser_omp_clause_collapse): Disallow tile. (cp_parser_omp_for_loop): Deal with tile clause. Don't emit a parse error about missing for after already emitting one. Use more conventional for idiom for unbounded loop. * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE. * semantics.c (finish_omp_clauses): Correct TILE semantic check. (finish_omp_for): Deal with tile clause. 2017-02-07 Nathan Sidwell * method.c (synthesized_method_base_walk): New. Broken out of ... (synthesized_method_walk): ... here. Call it. Cleanup initializations. 2017-02-07 Patrick Palka PR c++/79360 * typeck2.c (process_init_constructor_union): Consider only FIELD_DECLs when looking for an NSDMI. 2017-02-06 Jason Merrill PR c++/71193 - incomplete types in templates * parser.c (cp_parser_postfix_dot_deref_expression): In a template handle incomplete type by pedwarning and then treating as dependent. 2017-02-06 Jakub Jelinek PR c++/79379 * constexpr.c (cxx_eval_constant_expression): Handle ANNOTATE_EXPR. (potential_constant_expression_1): Likewise. PR c++/79377 * tree.c (build_min_non_dep_op_overload): For POST{INC,DEC}REMENT_EXPR allow one fewer than expected arguments if flag_permissive. PR c++/79372 * decl.c (cp_finish_decomp): On error set decl type to error_mark_node. * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions with error_mark_node type. 2017-02-03 Jason Merrill PR c++/78689 - ICE on constructor with label * optimize.c (maybe_clone_body): Replace omitted parameters with null lvalues. * class.c (build_clone): Fix logic for omitting inherited parms. PR c++/12245 - excessive memory use * constexpr.c (maybe_constant_value): Fold maybe_constant_value_1 back in. Don't cache constants. (maybe_constant_init): Don't cache constants. PR c++/79294 - ICE with invalid template argument * pt.c (convert_nontype_argument_function): Check value-dependence. (convert_nontype_argument): Don't check it here for function ptrs. 2017-02-02 Richard Biener PR cp/14179 * cp-gimplify.c (cp_fold): When folding a CONSTRUCTOR copy it lazily on the first changed element only and copy it fully upfront, only storing changed elements. 2017-02-02 Paolo Carlini PR c++/69637 * decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL to the width. 2017-01-31 Jakub Jelinek PR c++/79304 * error.c (dump_expr) : Don't print . after ARROW_EXPR. 2017-01-31 David Malcolm PR c++/79298 * name-lookup.c (suggest_alternative_in_explicit_scope): Resolve any namespace aliases. 2017-01-31 Nathan Sidwell PR c++/79290 * typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING. PR c++/67273 PR c++/79253 * pt.c: (instantiate_decl): Push to top level when current function scope doesn't match. Only push lmabda scope stack when pushing to top. * cp-tree.h (instantiate_decl): Make defer_ok bool. * pt.c: Fix instantiate_decl calls to pass true/false not 0/1 (instantiate_decl): Simplify and reorder state saving and restoration. PR c++/79264 * lambda.c (maybe_generic_this_capture): Deal with template-id-exprs. * semantics.c (finish_member_declaration): Assert class is being defined. 2017-01-30 Alexandre Oliva Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. 2017-01-27 Jason Merrill PR c++/78771 - ICE with inherited constructor. * call.c (build_over_call): Call deduce_inheriting_ctor here. * pt.c (tsubst_decl): Not here. * class.c (add_method): Or here. * method.c (deduce_inheriting_ctor): Handle clones. (implicitly_declare_fn): Don't deduce inheriting ctors yet. 2017-01-27 Adam Butcher PR c++/64382 * cp/parser.c (parsing_default_capturing_generic_lambda_in_template): New function. * cp/cp-tree.h: Declare it. * cp/semantics.c (finish_id_expression): Resolve names within a default capturing generic lambda defined within a template prior to instantiation to allow for captures to be added to the closure type. 2017-01-26 Jakub Jelinek PR c++/68727 * cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2. * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument. * parser.c (cp_parser_builtin_offsetof): Pass result of build_static_cast of null_pointer_node to finish_offsetof. * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use it for -Winvalid-offsetof pedwarn instead of trying to guess original offsetof type from EXPR. Save OBJECT_PTR as a new second operand to OFFSETOF_EXPR. * pt.c (tsubst_copy_and_build) : Adjust finish_offsetof caller, pass the second operand of OFFSETOF_EXPR as OBJECT_PTR. 2017-01-26 Jason Merrill * name-lookup.c (parse_using_directive): Deprecate strong using. PR c++/79176 - lambda ICE with -flto -Os * decl2.c (vague_linkage_p): Handle decloned 'tors. * tree.c (decl_linkage): Likewise. 2017-01-25 Martin Sebor * decl.c (grokdeclarator): Fix a typo in a comment. 2017-01-25 Jakub Jelinek PR c++/78896 * decl.c (cp_finish_decomp): Disallow memberwise decomposition of lambda expressions. PR c++/77914 * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with OPT_Wpedantic on lambda templates for -std=c++14 and higher. 2017-01-25 Maxim Ostapenko PR lto/79061 * decl.c (cxx_init_decl_processing): Pass main_input_filename to build_translation_unit_decl. 2017-01-24 Jakub Jelinek PR c++/79205 * cp-gimplify.c (cp_genericize_r): Add result of convert_from_reference on invisiref parm to p_set. 2017-01-24 Nathan Sidwell PR c++/78469 - defaulted ctor and inaccessible dtor * cp-tree.h (tsubst_flags): Add tf_no_cleanup. * init.c (build_new_1): Pass tf_no_cleanup to build_value_init. * tree.c (build_target_expr): Check tf_no_cleanup. PR c++/79118 - anon-members and constexpr * constexpr.c (cx_check_missing_mem_inits): Caller passes type not ctor decl. Recursively check anonymous members. (register_constexpr_fundef): Adjust cx_check_missing_mem_inits call. (explain_invalid_constexpr_fn): Likewise. 2017-01-23 Nathan Sidwell PR c++/71710 - template using directive of field * pt.c (tsubst_copy_and_build [COMPONENT_REF]): Move FIELD_DECL check earlier. PR c++/71406 - ICE with scope-ref'd template id exprs PR c++/77508 * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF before breaking up TEMPLATE_ID_EXPR. 2017-01-20 Nathan Sidwell PR c++/78495 - wrong code inherited ctor and invisi-ref parm * cp-gimplify.c (cp_generize_r): Don't skip thunks. 2017-01-20 David Malcolm PR c++/77829 PR c++/78656 * cp-tree.h (suggest_alternatives_for): Add bool param. (suggest_alternative_in_explicit_scope): New decl. * error.c (qualified_name_lookup_error): When SCOPE is a namespace that isn't the global one, call new function suggest_alternative_in_explicit_scope, only calling suggest_alternatives_for if it fails, and disabling near match searches fort that case. When SCOPE is the global namespace, pass true for new param to suggest_alternatives_for to allow for fuzzy name lookups. * lex.c (unqualified_name_lookup_error): Pass true for new param to suggest_alternatives_for. * name-lookup.c (consider_binding_level): Add forward decl. (suggest_alternatives_for): Add "suggest_misspellings" param, using it to conditionalize the fuzzy name-lookup code. (suggest_alternative_in_explicit_scope): New function. * parser.c (cp_parser_primary_expression): When calling finish_id_expression, pass location of id_expression rather than that of id_expr_token. (cp_parser_id_expression): Convert local "unqualified_id" from tree to cp_expr to avoid implicitly dropping location information. 2017-01-20 Marek Polacek PR c/64279 * call.c (build_conditional_expr_1): Warn about duplicated branches. * semantics.c (finish_expr_stmt): Build statement using the proper location. 2017-01-19 Jason Merrill US 20 - forwarding references and class template argument deduction * cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): New. * pt.c (push_template_decl_real): Set it. (maybe_adjust_types_for_deduction): Check it. (rewrite_template_parm): Copy it. US 19 - deduction guides and constructors * call.c (joust): Prefer deduction guides to constructors. * pt.c (build_deduction_guide): Set DECL_ARTIFICIAL. (deduction_guide_p): Check DECL_P. * decl.c (check_initializer): Always use build_aggr_init for array decomposition. PR c++/79130 - decomposition and direct-initialization * init.c (build_aggr_init): Communicate direct-initialization to build_vec_init. (build_vec_init): Check for array copy sooner. * parser.c (cp_parser_decomposition_declaration): Remove call to build_x_compound_expr_from_list. 2017-01-18 Jason Merrill PR c++/68666 - member variable template-id * typeck.c (finish_class_member_access_expr): Handle variable template-id. * pt.c (lookup_and_finish_template_variable): No longer static. * cp-tree.h: Declare it. 2017-01-18 Nathan Sidwell PR c++/78488 * call.c (build_over_call): When checking ellipsis conversions for an inherited ctor, make sure there is at least one conversion. 2017-01-18 Jason Merrill PR c++/78894 - ICE with class deduction and default arg * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE. 2017-01-18 Markus Trippelsdorf PR c++/77489 * mangle.c (write_discriminator): Reorganize abi warning check. 2017-01-18 Nathan Sidwell * cp-tree.h: Clarify exception spec node comment. * except.c (nothrow_spec_p): Simplify by checking node-equality. PR c++/79091 * mangle.c (write_exception_spec): Check nothrow explicitly. (write_encoding): Don't increment processing_template_decl around encoding. 2017-01-18 Markus Trippelsdorf PR c++/70182 * mangle.c (write_template_args): Add "on" for operator names. 2017-01-18 Markus Trippelsdorf PR c++/77489 * mangle.c (write_discriminator): Handle discriminator >= 10. 2017-01-17 Nathan Sidwell PR c++/61636 * cp-tree.h (maybe_generic_this_capture): Declare. * lambda.c (resolvable_dummy_lambda): New, broken out of ... (maybe_resolve_dummy): ... here. Call it. (maybe_generic_this_capture): New. * parser.c (cp_parser_postfix_expression): Speculatively capture this in generic lambda in unresolved member function call. * pt.c (tsubst_copy_and_build): Force hard error from failed member function lookup in generic lambda. 2017-01-17 Aldy Hernandez PR c++/70565 * cp-array-notation.c (expand_array_notation_exprs): Handle OMP_PARALLEL. 2017-01-11 Jason Merrill PR c++/78337 - ICE on invalid with generic lambda * semantics.c (process_outer_var_ref): Check if containing_function is null. Move inform call under complain test. 2017-01-11 Nathan Sidwell PR c++/77812 * name-lookup.c (set_namespace_binding_1): An overload of 1 decl is a new overload. 2017-01-11 Nathan Sidwell * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation. 2017-01-11 Jakub Jelinek PR c++/78341 * parser.c (cp_parser_std_attribute_spec): Remove over-eager assertion. Formatting fix. PR c++/72813 * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after writing PCH file. 2017-01-10 David Malcolm PR c++/77949 * parser.c (cp_parser_class_specifier_1): Only suggest inserting a missing semicolon if we have a valid insertion location for the fix-it hint. 2017-01-10 Jason Merrill FI 20, decomposition declaration with parenthesized initializer. * parser.c (cp_parser_decomposition_declaration): Use cp_parser_initializer. 2017-01-09 Jason Merrill Implement P0195R2, C++17 variadic using. * parser.c (cp_parser_using_declaration): Handle ellipsis and comma. * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE. * error.c (dump_decl): Likewise. 2017-01-09 Jakub Jelinek PR translation/79019 PR translation/79020 * semantics.c (finish_omp_clauses): Add missing whitespace to translatable strings. * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo. 2017-01-07 Jason Merrill PR c++/78948 - instantiation from discarded statement * parser.h (struct cp_parser): Remove in_discarded_stmt field. * cp-tree.h (in_discarded_stmt): Declare it. (struct saved_scope): Add discarded_stmt bitfield. (in_discarded_stmt): New macro. * decl2.c (mark_used): Check it. * parser.c (cp_parser_selection_statement): Adjust. (cp_parser_jump_statement): Adjust. 2017-01-05 Jakub Jelinek PR c++/78931 * decl.c (cp_finish_decomp): Remove probe variable, if tt is REFERENCE_REF_P, set tt to its operand. PR c++/78890 * class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in unions even for C++11 and later. 2017-01-05 Nathan Sidwell PR c++/78765 * pt.c (convert_nontype_argument): Don't try and see if integral or enum expressions are constants prematurely. 2017-01-04 Marek Polacek PR c++/64767 * typeck.c (cp_build_binary_op): Warn when a pointer is compared with a zero character literal. 2017-01-04 Jakub Jelinek PR c++/78949 * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has vector type. PR c++/78693 * parser.c (cp_parser_simple_declaration): Only complain about inconsistent auto deduction if auto_result doesn't use auto. * parser.c (cp_parser_simple_declaration): Diagnose function declaration among more than one init-declarators with auto specifier. PR c++/71182 * parser.c (cp_lexer_previous_token): Use vec_safe_address in the assertion, as lexer->buffer may be NULL. 2017-01-04 Marek Polacek PR c++/77545 PR c++/77284 * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT. 2017-01-04 Nathan Sidwell PR c++/66735 * cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New. (lambda_capture_field_type): Update prototype. * lambda.c (lambda_capture_field_type): Add is_reference parm. Add referenceness here. (add_capture): Adjust lambda_capture_field_type call, refactor error checking. * pt.c (tsubst): Adjust lambda_capture_field_type call. 2017-01-01 Jakub Jelinek Update copyright years. Copyright (C) 2017 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.