view gcc/cp/ChangeLog @ 16:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
children 84e7813d76e9
line wrap: on
line source

2017-10-26  Nathan Sidwell  <>

	* decl.c (sort_labels): Restore function.
	(pop_labels): Sort labels
	(identify_goto): Add translation markup.

2017-10-25  Nathan Sidwell  <>

	* cp-tree.h (lang_identifier): Delete label_value slot.
	(struct named_label_hasher): Rename to ...
	(struct named_label_hash): ... here.  Reimplement.
	(struct language_function): Adjust x_named_labels.
	* name-lookup.h (struct cp_label_binding): Delete.
	(struct cp_binding_level): Delete shadowed_labels slot.
	* decl.c (struct named_label_entry): Add name and outer slots.
	(pop_label): Rename to ...
	(check_label_used): ... here.  Don't pop.
	(note_label, sort_labels): Delete.
	(pop_labels, pop_local_label): Reimplement.
	(poplevel): Pop local labels as any other decl. Remove
	shadowed_labels handling.
	(named_label_hash::hash, named_label_hash::equal): New.
	(make_label_decl): Absorb into ...
	(lookup_label_1): ... here.  Add making_local_p arg, reimplement.
	(lookup_label, declare_local_label): Adjust.
	(check_goto, define_label): Adjust.
	* lex.c (make_conv_op_name): Don't clear IDENTIFIER_LABEL_VALUE.
	* ptree.c (cxx_print_identifier): Don't print identifier binding.

	* decl.c (identifier_goto): Reduce duplication.
	(check_previous_goto_1): Likewise.
	(check_goto): Move var decls to initialization.
	(check_omp_return, define_label_1, define_label): Likewise.

2017-10-25  Jakub Jelinek  <>

	PR libstdc++/81706
	* decl.c (duplicate_decls): Copy "omp declare simd" attributes from
	newdecl to corresponding __builtin_ if any.

2017-10-24  Paolo Carlini  <>

	PR c++/82466
	* decl.c (duplicate_decls): Warn for built-in functions declared as
	non-function, use OPT_Wbuiltin_declaration_mismatch.

	* decl.c (duplicate_decls): Avoid redundant '+' in warning_at.

2017-10-24  Paolo Carlini  <>

	PR c++/80991
	* pt.c (value_dependent_expression_p, [TRAIT_EXPR]): Handle

2017-10-24  Mukesh Kapoor  <>
	    Paolo Carlini  <>

	PR c++/82307
	* cvt.c (type_promotes_to): Implement C++17, 7.6/4, about unscoped
	enumeration type whose underlying type is fixed.

2017-10-23  Paolo Carlini  <>

	PR c++/80449
	* semantics.c (finish_compound_literal): Check do_auto_deduction
	return value for error_mark_node.

2017-10-23  Jason Merrill  <>

	PR c++/77369 - wrong noexcept handling in C++14 and below
	* tree.c (strip_typedefs): Canonicalize TYPE_RAISES_EXCEPTIONS.

2017-10-20  Nathan Sidwell  <>

	* class.c (layout_class_type): Cleanup as-base creation, determine
	mode here.
	(finish_struct_1): ... not here.

2017-10-19  Jakub Jelinek  <>

	PR c++/82600
	* typeck.c (check_return_expr): Don't call
	maybe_warn_about_returning_address_of_local in templates.

2017-10-17  Nathan Sidwell  <>

	PR c++/82560
	* call.c (build_over_call): Don't pass tf_no_cleanup to nested

	PR middle-end/82546
	* cp-objcp-common.c (cp_tree_size): Reformat.  Adjust returns size
	of TYPE nodes.

2017-10-13  Jason Merrill  <>

	PR c++/82357 - bit-field in template
	* tree.c (cp_stabilize_reference): Just return a NON_DEPENDENT_EXPR.

2017-10-13  David Malcolm  <>

	* cp-tree.h (maybe_show_extern_c_location): New decl.
	* decl.c (grokfndecl): When complaining about literal operators
	with C linkage, issue a note giving the location of the
	extern "C".
	* parser.c (cp_parser_new): Initialize new field
	(cp_parser_linkage_specification): Store the location
	of the linkage specification within the cp_parser.
	(cp_parser_explicit_specialization): When complaining about
	template specializations with C linkage, issue a note giving the
	location of the extern "C".
	(cp_parser_explicit_template_declaration): Likewise for templates.
	(maybe_show_extern_c_location): New function.
	* parser.h (struct cp_parser): New field

2017-10-12  Nathan Sidwell  <>

	* cp-tree.h (cp_expr): Add const operator * and operator->
	(cp_tree_node_structure_enum): Delete TS_CP_BINDING,

2017-10-12  David Malcolm  <>

	* parser.c (get_required_cpp_ttype): New function.
	(cp_parser_error_1): Call it, using the result to call

2017-10-12  David Malcolm  <>

	* parser.c (get_matching_symbol): Move to before...
	(cp_parser_error): Split out into...
	(cp_parser_error_1): ...this new function, merging in content
	(cp_parser_required_error):  Eliminate partial duplicate
	of body of cp_parser_error in favor of a call to the new
	cp_parser_error_1 helper function.

2017-10-11  Nathan Sidwell  <>

	* decl2.c (struct mangled_decl_hash): Use DECL_ASSEMBLER_NAME_RAW.
	(record_mangling): Likewise.

2017-10-10  Nathan Sidwell  <>

	* name-lookup.c (extern_c_fns): Rename to ...
	(extern_c_decls): ... here.
	(check_extern_c_conflict, extern_c_linkage_bindings): Update.
	(do_pushdecl): Check extern-c fns and vars.

	* cp-tree.h (default_hash_traits <lang_identifier *>): Delete

	* decl2.c (struct mangled_decl_hash): New hash traits.
	(mangled_decls): Make hash_table<mangled_decl_hash>.
	(generate_mangling_alias, record_mangling): Adjust.

2017-10-10  Jason Merrill  <>

	More delayed lambda capture fixes.
	* call.c (add_function_candidate): Use build_address.
	(build_op_call_1): Call mark_lvalue_use early.
	(build_over_call): Handle error from build_this.
	* constexpr.c (cxx_bind_parameters_in_call): Use build_address.
	(cxx_eval_increment_expression): Don't use rvalue().
	* cvt.c (convert_to_void): Use mark_discarded_use.
	* expr.c (mark_use): Handle PARM_DECL, NON_DEPENDENT_EXPR.  Fix
	reference handling.  Don't copy the expression.
	(mark_discarded_use): New.
	* lambda.c (insert_capture_proxy): Add some sanity checking.
	(maybe_add_lambda_conv_op): Set cp_unevaluated_operand.
	* pt.c (register_local_specialization): Add sanity check.
	* semantics.c (process_outer_var_ref): Fix check for existing proxy.
	* typeck.c (cp_build_addr_expr_1): Handle error from
	(cp_build_modify_expr): Call mark_lvalue_use_nonread, handle error
	from rvalue.

	Handle generic lambda capture in dependent expressions.
	* lambda.c (need_generic_capture, dependent_capture_r)
	(do_dependent_capture): New.
	* pt.c (processing_nonlambda_template): Use need_generic_capture.
	* semantics.c (maybe_cleanup_point_expr)
	(maybe_cleanup_point_expr_void, finish_goto_stmt)
	(maybe_convert_cond): Call do_dependent_capture.
	* typeck.c (build_static_cast): Remove dependent capture handling.

	* typeck.c (condition_conversion): Assert !processing_template_decl.
	* semantics.c (finish_omp_clauses): Don't
	fold_build_cleanup_point_expr if processing_template_decl.
	(outer_var_p): A temporary can't be from an outer scope.
	* pt.c (type_dependent_expression_p): Fix dependency checking of
	functions without DECL_TEMPLATE_INFO.
	(instantiate_decl): Use lss_copy.
	* constexpr.c (is_valid_constexpr_fn): Fix lambdas before C++17.

	* typeck.c (check_return_expr): Check non-dependent conversion in
	* (check_function_concept): Don't complain about an
	empty concept if seen_error.

2017-10-10  Richard Sandiford  <>

	* cvt.c (ignore_overflows): Use wi::to_wide when
	operating on trees as wide_ints.
	* decl.c (check_array_designated_initializer): Likewise.
	* mangle.c (write_integer_cst): Likewise.
	* semantics.c (cp_finish_omp_clause_depend_sink): Likewise.

2017-10-10  Nathan Sidwell  <>

	* name-lookup.c (set_global_binding): Don't deal with STAT_HACK.

2017-10-06  Paolo Carlini  <>

	PR c++/47791
	* decl.c (finish_function): Take a bool intead of an int; adjust.
	* cp-tree.h (finish_function): Adjust declaration.
	* decl2.c (generate_tls_wrapper, finish_objects,
	finish_static_storage_duration_function): Adjust calls.
	* lambda.c (maybe_add_lambda_conv_op, finish_lambda_function):
	* method.c (synthesize_method): Likewise.
	* optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
	* pt.c (instantiate_decl): Likewise.
	* parser.c (cp_parser_function_definition_after_declarator,
	cp_parser_late_parsing_for_member, cp_parser_omp_declare_reduction):
	cp_parser_function_transaction): Return void; adjust declarations.

2017-10-06  Nathan Sidwell  <>

	PR c++/82424
	* name-lookup.c (check_local_shadow): Don't try and convert
	dependent types.

2017-10-06  Jakub Jelinek  <>

	PR c++/82299
	* decl.c (reshape_init): Suppress warn_useless_cast for direct enum
	* typeck.c (convert_for_assignment): Likewise.

	P0704R1 - fixing const-qualified pointers to members
	* typeck2.c (build_m_component_ref): For -std=c++2a allow
	pointer to const & qualified method on rvalue.

2017-10-06  Nathan Sidwell  <>

	Use hash_table for extern "C" names
	* name-lookup.c (extern_c_fns): Use hash_table.
	(check_extern_c_conflict): Adjust.
	(c_linkage_bindings): Adjust.

	Use hash_table for namespace bindings
	* cp-tree.h (struct named_decl_hash): New.
	(lang_decl_ns): Change type of bindings field.
	* lex.c (maybe_add_lang_decl_raw): Adjust.
	* name-lookup.c (find_namespace_slot): Adjust.
	(do_pushdecl): Push NULL-named namespace.
	(do_push_nested_namespace): Adjust.
	(push_namespace): Push anonymous namespace as NULL name.

2017-10-05  Jason Merrill  <>

	Pass variadic class objects exactly like named by-value args.
	* call.c (convert_arg_to_ellipsis): Use the result of force_rvalue.

2017-10-05  Nathan Sidwell  <>

	Warn on MVP declarations
	* cp-tree.h (struct cp_declarator): Add parenthesized field.
	* decl.c (grokdeclarator): Warn about unnecessary parens.
	* parser.c (make_declarator): Init parenthesized field.
	(cp_parser_direct_declarator): Set parenthesized field.

	* name-lookup.h (set_global_binding): Remove NAME parm.
	(get_global_binding): New inline fn.
	* name-lookup.c (set_global_binding): Remove NAME parm. Adjust.
	(identifier_global_value): Move to ...
	* cp-objcp-common.c (identifier_global_value): ... here.
	* class.c (build_ctor_vtbl_group, build_vtbl_initializer): Adjust.
	* decl.c (record_builtin_type, expand_static_init,
	grokdeclarator): Adjust.
	* decl2.c (get_guard, get_local_tls_init_fn, get_tls_init_fn,
	get_tls_wrapper_fn, maybe_warn_sized_delete): Adjust.
	* except.c (declare_library_fn, build_throw): Adjust.
	* init.c (throw_bad_array_length): Adjust.
	* rtti.c (throw_bad_cast, throw_bad_typeid, get_tinfo_decl): Adjust.

	* decl2.c (record_mangling): Fix spello and formatting from
	previous patch.

2017-10-04  Nathan Sidwell  <>

	Give builtin types the correct name.
	* name-lookup.c (set_global_binding): Assert name is DECL_NAME.
	* decl.c (record_builtin_type): Reimplement, use new TYPE_DECL for

2017-10-04  Paolo Carlini  <>
	    Andrew Pinski  <>

	PR c++/71946
	* parser.c (cp_parser_lambda_body): Set parser->in_function_body.

2017-10-04  Nathan Sidwell  <>

	Move mangling aliases out of global namespace.
	* cp-tree.h (record_mangling): New.
	(maybe_remove_implicit_alias): Delete.
	* decl2.c (mangled_decls): New hash map.
	(generate_mangling_alias): Reimplement using mangled_decls.
	(record_mangling): New.
	* mangle.c (decl_implicit_alias_p,
	maybe_remove_implicit_alias): Delete.
	(mangle_decl): Use record_mangling.
	* name-lookup.c (supplement_binding_1): Remove
	maybe_remove_implicit_alias check.

2017-10-04  Jakub Jelinek  <>

	PR c++/82373
	* error.c (dump_function_decl): If show_return, call dump_type_suffix
	on the same return type dump_type_prefix has been called on.

2017-10-04  Jason Merrill  <>

	PR c++/81525 - broken handling of auto in generic lambda.
	* pt.c (tsubst_decl) [VAR_DECL]: Use strip_innermost_template_args.

2017-10-04  Nathan Sidwell  <>

	* call.c (convert_arg_to_ellipsis): Correct comment about passing
	by reference.

2017-10-02  Richard Sandiford  <>

	* constexpr.c (cxx_eval_store_expression): Use wi::to_widest
	when comparing the array bounds with an ARRAY_REF index.

2017-09-30  Paolo Carlini  <>

	PR c++/68754
	* method.c (defaulted_late_check): Early return if the defaulted
	declaration does not match the expected signature.

2017-09-29  Jakub Jelinek  <>

	P0683R1 - default member initializers for bit-fields
	* cp-tree.h (grokbitfield): Add INIT parameter.
	* parser.c (cp_parser_constant_expression): Add STRICT_P argument,
	if true, parse a conditional-expression rather than
	(cp_parser_member_declaration): For C++11 and later pass true
	as STRICT_P to cp_parser_constant_expression.  Parse C++2A bitfield
	NSDMIs.  Adjust grokbitfield caller.  Handle DECL_INITIAL also for
	(cp_parser_objc_class_ivars): Adjust grokbitfield caller.
	* class.c (check_field_decl): Recurse even for DECL_C_BIT_FIELDs.
	(check_field_decls): Call check_field_decl even for DECL_C_BIT_FIELDs.
	* decl2.c (grokbitfield): Add INIT parameter, pass it to
	* pt.c (tsubst_decl): Handle DECL_INITIAL for all FIELD_DECLs, not
	just non-bitfields.

	* class.c (check_bitfield_decl): Retrieve and clear width from
	(check_field_decls): Test DECL_BIT_FIELD_REPRESENTATIVE rather than
	(remove_zero_width_bit_fields): Adjust comment.
	* decl2.c (grokbitfield): Stash width into
	* pt.c (tsubst_decl): For DECL_C_BIT_FIELD, tsubst_expr

	* parser.c (cp_parser_member_declaration): Parse attributes before
	colon of a bitfield in addition to after colon.

	* (check-c++-all): Test also c++2a.

2017-09-28  Jason Merrill  <>

	PR c++/56973, DR 696 - capture constant variables only as needed.
	* expr.c (mark_use): Split out from mark_rvalue_use and
	mark_lvalue_use.  Handle lambda capture of constant variables.
	(mark_lvalue_use_nonread): New.
	* semantics.c (process_outer_var_ref): Don't capture a constant
	variable until forced.
	* pt.c (processing_nonlambda_template): New.
	* call.c (build_this): Check it.
	* decl2.c (grok_array_decl): Call mark_rvalue_use and
	* init.c (constant_value_1): Don't call mark_rvalue_use.
	* typeck.c (build_static_cast): Handle lambda capture.

	Use local_specializations to find capture proxies.
	* cp-tree.h (DECL_CAPTURED_VARIABLE): New.
	* lambda.c (build_capture_proxy): Set it.
	(add_capture): Pass initializer to build_capture_proxy.
	(start_lambda_function): Likewise.
	(insert_capture_proxy): Use register_local_specialization.
	(is_lambda_ignored_entity): Always ignore proxies.
	* name-lookup.c (qualify_lookup): Don't check
	is_lambda_ignored_entity if LOOKUP_HIDDEN is set.
	* semantics.c (process_outer_var_ref): Use
	* parser.c (cp_parser_lambda_body): Push local_specializations.
	* pt.c (tsubst_expr): Pass LOOKUP_HIDDEN when looking for a proxy.
	(tsubst_lambda_expr): Push local_specializations sooner.
	(tsubst_copy_and_build): Don't register_local_specialization.

	* call.c (build_special_member_call): Use the return value of
	* decl.c (compute_array_index_type): Likewise.
	* parser.c (cp_parser_oacc_wait_list): Likewise.
	* lambda.c (is_normal_capture_proxy): Handle *this capture.
	(add_capture): Clarify internal_error message.

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
	* 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
	(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

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
	(write_exception_spec, start_mangling, mangle_decl): Likewise.
	* (check-c++1z): Rename to check-c++17, depend on
	(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.

	* cp-tree.h (struct lang_type): Rename methods to members.
	(CLASSTYPE_METHOD_VEC): Rename to ...
	* 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  <>

	* cp-tree.h (struct lang_type): Lose sorted_fields member.
	* 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
	(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

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

	* 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.
	* 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
	(DECL_CONV_FN_TYPE): FN must be conv op.
	* pt.c (push_template_decl_real): Delete DECL_TEMPLATE_CONV_FN_P

	* class.c (unreverse_member_declarations): Remove extraneous if.
	* pt.c (push_template_decl_real): Use string concatenation, not
	\<newline>.  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
	(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
	(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.
	* 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

	Reimplement handling of lambdas in templates.
	* 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
	(find_parameter_packs_r): Ignore capture proxies.  Look into
	(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
	(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.

	(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
	* constexpr.c (ensure_literal_type_for_constexpr_object): Check
	(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

	* 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
	* 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
	* parser.c (cp_parser_late_parsing_default_args): Remember

2017-08-28  Nathan Sidwell  <>

	* cp-tree.h (lang_type): Replace sorted_fields vector with
	bindings map.
	* decl.c (finish_enum_value_list): Swap args of
	* 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):
	* 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_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
	(conv_op_marker, conv_op_identifier): New.
	* decl.c (initialize_predefined_identifiers): Add
	(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
	(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
	* 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.

	* 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

	* cp-tree.h (struct lang_type): Remove template_info field.

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
	(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
	(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
	class matching_parens, so that the pertinent open parenthesis is
	highlighted when there are problems locating the close
	(cp_parser_primary_expression): Likewise.
	(cp_parser_compound_literal_p): Remove consumption of opening
	(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_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
	(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
	(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
	(cp_parser_require_keyword): Update for new param of
	(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): 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
	(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

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
	* constexpr.c (potential_constant_expression_1): Handle

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
	* 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
	(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

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.
	(CLASSTYPE_CONSTRUCTORS): Use lookup_fnfields_slot_nolazy.
	* 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  <>

	* 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_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.


2017-07-18  Nathan Sidwell  <>

	* cp-array-notation.c (build_array_notation_ref): Use

	* 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 <initializer_list>.
	* rtti.c: Include "gcc-rich-location.h".
	(typeid_ok_p): Attempt to add fix-it hint for missing
	#include <typeinfo>.

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  <>

	identifier flags.
	* decl.c (grokfndecl): Set DECL_CXX_CONSTRUCTOR and
	* 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): 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
	(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  <>

	* (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
	(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
	* pt.c (retrieve_specialization): Use lookup_fnfields_slot.
	(check_explicit_specialization): Use lookup_fnfields_slot_nolazy,
	* 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

	* 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
	* 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

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  <>

	* 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

	* 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.
	* 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.
	* (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
	(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

	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 <FUNCTION_DECL>): Move var decls to
	initialization point.  Don't unnecessarily check for ctor name.

	* cp-tree.h (CLASSTYPE_DESTRUCTORS): Rename to ...
	* class.c (accessible_nvdtor_p,
	clone_constructors_and_destructors, type_has_virtual_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.

	* cp-tree.h (lang_identifier): Remove class_template_info field.
	* 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

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.c (grok_op_properties): Adjust identifier checking.
	* init.c (expand_default_init): Adjust identifier descision.
	* method.c (implicitly_declare_fn): Don't use
	* search.c (lookup_fnfields_1): Use IDENTIFIER_CTOR_P,
	* call.c (in_charge_arg_for_name): Reimplement.
	(build_special_member_call): Use IDENTIFIER_CDTOR_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
	(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
	* cp-tree.h (enum cp_identifier_kind): New.
	(C_IS_RESERVED_WORD): Replace with ...
	(IDENTIFIER_CTOR_OR_DTOR_P): Replace with ...
	(IDENTIFIER_CDTOR_P): ... this.
	(IDENTIFIER_OPNAME_P): Replace with ...
	(IDENTIFIER_ANY_OP_P): ... this.
	(IDENTIFIER_TYPENAME_P): Replace with ...
	(IDENTIFIER_CONV_OP_P): ... this.
	(NEW_DELETE_OPNAME_P): Replace with ...
	(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
	(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

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

	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
	* 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

	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 <lang_identifier *>): Don't
	derive from pointer_hash.  Make undeletable.

	* class.c (resort_type_method_vec): Avoid potential unsigned

	Don't defer noexcept_deferred_spec.
	* cp-tree.h (unevaluated_noexcept_spec): Don't declare.
	* decl.c (cxx_init_decl_processing): Initialize
	* 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,
	(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

2017-06-15  Martin Sebor  <>

	PR c++/80560
	* call.c (first_non_public_field, maybe_warn_class_memaccess): New
	(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

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

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
	* 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

	* 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

	* 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

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

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.
	* 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
	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
	(suggest_alternatives_for): Adjust for namespace list.  Do
	breadth-first search.
	* decl2.c (collect_source_refs): Namespaces are on the regulr
	(collect_ada_namespace): Likewise.

2017-06-02  Bernd Edlinger  <>

	* typeck.c (cp_build_binary_op): Implement the -Wsizeof_pointer_div

2017-06-01  Ville Voutilainen  <>

	PR c++/80812
	* method.c (constructible_expr): Strip array types before calling

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
	(lang_decl): Use enum for discrimination.
	(DECL_DECOMPOSITION_P): Use selector value.
	(retrofit_lang_decl): Lose SEL parm.
	(fit_decomposition_lang_decl): Declare.
	* decl.c (cp_finish_decomp, grokdeclarator): Use
	* lex.c (maybe_add_lang_decl_raw): New. Broken out of
	(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  <>

	* cp-tree.h (lang_identifier): Delete namespace_bindings.
	(lang_decl_ns): Add bindings.
	* 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
	(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
	(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,
	(stat_hack): New.
	(find_namespace_binding): Replace with ...
	(find_namespace_slot): ... this.
	(find_namespace_value): New.
	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

	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.
	* name-lookup.h (struct cp_binding_level): Change usings
	* 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.
	(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
	(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.
	(DECL_DECOMPOSITION_P): Note it is set also on the vars
	for user identifiers.
	(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.
	* 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

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  <>

	* 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.	

	* cp-tree.h (lang_decl_ns): Remove ns_users field.
	* 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, 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.

	* (CXX_AND_OBJCXX_OBJS): Alphabetize.

	* cp-tree.h (cp_free_lang_data): Add extern.
	(ovl_skip_hidden, is_overloaded_fn, really_overloaded_fn): Add
	(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
	(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  <>


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
	(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.
	(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.

	* (gtfiles): Sort list, break lines.

	* cp-tree.h (CPTI_TERMINATE, CPTI_CALL_UNEXPECTED): Rename to ...
	(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  <>

	* (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.
	* 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
	* method.c (lazily_declare_fn): Assert we added it.
	* parser.c (cp_parser_nested_name_specifier): Use OVL_SINGLE_P,
	(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

	* 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.
	* 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
	* 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 <lang_identifier *>): New
	* 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.
	(is_xible): New.
	* cxx-pretty-print.c (pp_cxx_trait_expression): Handle
	* 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
	(cp_parser_trait_expr): Likewise.
	* semantics.c (trait_expr_value): Handle

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.
	* (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
	(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
	* 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

	* 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 &
	* class.c (deduce_noexcept_on_destructors): Use ovl_iterator.
	type_has_move_constructor, type_has_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
	*	(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
	* 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
	* 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,
	* cp-objcp-common.c (cp_get_global_decls, cp_pushdec,
	* 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,
	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
	(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
	(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_overload_resolution_failure): Call unify_invalid.

	CWG 1847 - Clarifying compatibility during partial ordering
	* pt.c (more_specialized_fn): No order between two non-deducible

	* pt.c (dependent_type_p): Make sure we aren't called with

	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
	* 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
	(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
	(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

2017-05-09  Nathan Sidwell  <>

	* cp-lang.c (get_global_decls, cxx_pushdecl): New.
	* 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.
	* 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.
	* 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
	* 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
	(set_namespace_binding_1): Rename to
	(set_namespace_binding): ... here.
	(set_global_value): New.
	(lookup_name_innermost_nonclass_level_1, push_namespace): Use
	* 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.
	diagnose_inline_vars_for_namespace): Replace with ...
	(wrapup_namespace_globals): ... this.
	* decl.c (static_decls): Define.
	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  <>

	* (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.
	* (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,
	(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): 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
	* 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

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
	* pt.c (value_dependent_expression_p) <case VAR_DECL>: For variables
	with DECL_VALUE_EXPR, return true if DECL_VALUE_EXPR is type

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

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

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

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

	PR libstdc++/80251
	* cp-tree.h (enum cp_trait_kind): Add CPTK_IS_AGGREGATE.
	* cxx-pretty-print.c (pp_cxx_trait_expression): Handle
	* 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
	(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) <case OMP_CLAUSE_SIMDLEN,
	case OMP_CLAUSE_ALIGNED>: Call maybe_constant_value only when not

2017-03-21  Paolo Carlini  <>

	PR c++/77752
	* name-lookup.c (pushtag_1): Add check for bogus, non template,

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

	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

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

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

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

	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

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

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

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

2017-02-27  Jason Merrill  <>

	PR c++/71568 - SFINAE forming pointer to member function
	* init.c (build_offset_ref): Check the return value of

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
	* 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

	* 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
	* 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

	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

	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

	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

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

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

	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

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
	* 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
	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
	(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
	* 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

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) <case COMPONENT_REF>: 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

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) <case OFFSETOF_EXPR>: Adjust
	finish_offsetof caller, pass the second operand of OFFSETOF_EXPR

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
	(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

2017-01-19  Jason Merrill  <>

	US 20 - forwarding references and class template argument deduction
	* 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

	PR c++/79130 - decomposition and direct-initialization
	* init.c (build_aggr_init): Communicate direct-initialization to
	(build_vec_init): Check for array copy sooner.
	* parser.c (cp_parser_decomposition_declaration): Remove call to

2017-01-18  Jason Merrill  <>

	PR c++/68666 - member variable template-id
	* typeck.c (finish_class_member_access_expr): Handle variable
	* 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

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

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

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

	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.