2018-05-07 Jason Merrill PR c++/85646 - lambda visibility. * decl2.c (determine_visibility): Don't mess with template arguments from the containing scope. (vague_linkage_p): Check DECL_ABSTRACT_P before looking at a 'tor thunk. 2018-04-23 Ville Voutilainen Backport from mainline 2018-04-05 Ville Voutilainen Implement P0969 * decl.c (find_decomp_class_base): Check accessibility instead of declared access, adjust diagnostic. 2018-04-23 Jakub Jelinek Jason Merrill PR c++/85470 - wrong error with static data member. * decl.c (check_initializer): Check DECL_INITIALIZED_IN_CLASS_P. * typeck2.c (store_init_value): Likewise. 2018-04-23 Ville Voutilainen Backport from mainline 2018-04-05 Ville Voutilainen Implement P0961 * decl.c (get_tuple_decomp_init): Check the templatedness of a member get. 2018-04-19 Jonathan Wakely PR c++/85464 - missing location for -Wignored-qualifiers diagnostic * decl.c (grokdeclarator): If declspecs->locations[ds_type_spec] is UNKNOWN_LOCATION fall back to input_location. 2018-04-09 Jason Merrill PR c++/85279 - dump_expr doesn't understand decltype. * error.c (dump_expr): Handle DECLTYPE_TYPE. 2018-04-05 Jason Merrill PR c++/82152 - ICE with class deduction and inherited ctor. * pt.c (do_class_deduction): Ignore inherited ctors. PR c++/84665 - ICE with array of empty class. * decl2.c (cp_check_const_attributes): Use fold_non_dependent_expr. PR c++/85006 - -fconcepts ICE with A return type * pt.c (tsubst_pack_expansion): Allow unsubstituted auto pack. 2018-04-04 Jason Merrill PR c++/85118 - wrong error with generic lambda and std::bind. * call.c (add_template_conv_candidate): Disable if there are any call operators. PR c++/85148 - ICE with 'this' in array NSDMI. * tree.c (replace_placeholders_r): Use handled_component_p. 2018-04-03 Jason Merrill PR c++/85113 - ICE with constexpr and __builtin_constant_p. * constexpr.c (cxx_eval_builtin_function_call): Only defer __builtin_constant_p if ctx->quiet. * typeck.c (merge_types): Limit matching attribute shortcut to the default case. PR c++/64095 - auto... parameter pack. * parser.c (cp_parser_parameter_declaration): Handle turning autos into packs here. (cp_parser_parameter_declaration_list): Not here. PR c++/85060 - wrong-code with call to base member in template. * search.c (any_dependent_bases_p): Check uses_template_parms rather than processing_template_decl. 2018-03-29 Ville Voutilainen Backport from mainline 2018-03-23 Ville Voutilainen Implement P0962 * parser.c (cp_parser_perform_range_for_lookup): Change the condition for deciding whether to use members. 2018-03-23 Jason Merrill PR c++/78489 - Substitution in wrong order PR c++/84489 * pt.c (type_unification_real): Revert last two changes. PR c++/71834 - template-id with too few arguments. * pt.c (coerce_template_parms): Make sure we gave an error. PR c++/84937 - ICE with class deduction and auto. * pt.c (rewrite_template_parm): Fix auto handling. PR c++/80227 - SFINAE and negative array size. * decl.c (compute_array_index_type): Convert to signed for negative check. PR c++/84839 - ICE with decltype of parameter pack. * pt.c (tsubst_pack_expansion): Set cp_unevaluated_operand while instantiating dummy parms. PR c++/84798 - ICE with auto in abstract function declarator. * parser.c (cp_parser_parameter_declaration_clause): Check parser->default_arg_ok_p. PR c++/84355 - ICE with deduction for member class template. * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Always substitute into CLASS_PLACEHOLDER_TEMPLATE. 2018-03-23 Paolo Carlini Jason Merrill PR c++/82336 - link error with list-init default argument. * decl.c (check_default_argument): Unshare an initializer list. 2018-03-22 Marek Polacek Backported from mainline 2018-03-22 Marek Polacek PR c++/84854 * semantics.c (finish_if_stmt_cond): Check if the type of the condition is boolean. 2018-03-19 Marek Polacek PR c++/84927 * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags as we evaluate the elements. (cxx_eval_constant_expression): Verify constructor's flags unconditionally. 2018-03-21 Marek Polacek PR c++/71638, ICE with NSDMI and reference. * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags even when we replace an element. 2018-03-09 Jason Merrill PR c++/84785 - ICE with alias template and default targs. * pt.c (type_unification_real): Set processing_template_decl if saw_undeduced == 1. 2018-03-07 Marek Polacek Backported from mainline 2018-03-06 Marek Polacek PR c++/84684 * constexpr.c (cxx_bind_parameters_in_call): Unshare evaluated arguments. 2018-03-03 Jason Merrill PR c++/84686 - missing volatile loads. * cvt.c (convert_to_void): Call maybe_undo_parenthesized_ref. 2018-03-03 Jakub Jelinek Backported from mainline 2018-02-26 Jakub Jelinek PR c++/84558 * constexpr.c (cxx_eval_vec_init_1): For reuse, treat NULL eltinit like a valid constant initializer. Formatting fixes. PR c++/84557 * parser.c (cp_parser_omp_var_list_no_open): Only call cp_parser_lookup_name_simple on names satisfying identifier_p. (cp_parser_oacc_routine): Likewise. 2018-02-20 Jakub Jelinek PR c++/84445 * class.c (fixed_type_or_null) : Only test TREE_HAS_CONSTRUCTOR if instance is not an internal function call. PR c++/84449 * tree.c (bot_manip): If build_cplus_new or break_out_target_exprs returns error_mark_node, return it immediately. (break_out_target_exprs): If cp_walk_tree with bot_manip returns error_mark_node, return error_mark_node. 2018-02-19 Jakub Jelinek PR c++/84448 * parser.c (cp_parser_binary_expression): For no_toplevel_fold_p, if either operand is error_mark_node, set current.lhs to that instead of creating a binary op with error_mark_node operands. PR c++/84430 * constexpr.c (potential_constant_expression_1): Handle OMP_SIMD. 2018-02-16 Marek Polacek Jakub Jelinek PR c++/84192 * constexpr.c (cxx_eval_constant_expression) : Don't set *jump_target to anything if jump_target is NULL. 2018-02-12 Jakub Jelinek PR c++/84341 * parser.c (cp_parser_binary_expression): Use build_min instead of build2_loc to build the no_toplevel_fold_p toplevel binary expression. 2018-02-10 Jakub Jelinek PR sanitizer/83987 * tree.c (cp_free_lang_data): Revert 2018-01-23 change. 2018-02-09 Marek Polacek Jakub Jelinek PR c++/83659 * constexpr.c (cxx_fold_indirect_ref): Sync some changes from fold_indirect_ref_1. Verify first that tree_fits_shwi_p (op01). Formatting fixes. 2018-02-07 Jakub Jelinek PR c++/84082 * parser.c (cp_parser_dot_deref_incomplete): New function. (cp_parser_postfix_dot_deref_expression): Use it. 2018-01-31 Jason Merrill Jakub Jelinek PR c++/83993 * constexpr.c (cxx_eval_outermost_constant_expr): Build NOP_EXPR around non-constant ADDR_EXPRs rather than clearing TREE_CONSTANT on ADDR_EXPR. 2018-01-25 Jakub Jelinek PR c++/84031 * decl.c (find_decomp_class_base): Ignore unnamed bitfields. Ignore recursive calls that return ret. (cp_finish_decomp): Ignore unnamed bitfields. 2018-01-23 Jakub Jelinek PR sanitizer/83987 * tree.c (cp_free_lang_data): Change DECL_VALUE_EXPR of DECL_OMP_PRIVATIZED_MEMBER vars to error_mark_node. PR c++/83958 * decl.c (cp_finish_decomp): Diagnose if reference structure binding refers to incomplete type. 2018-01-18 Jakub Jelinek PR c++/83824 * parser.c (attr_chainon): New function. (cp_parser_label_for_labeled_statement, cp_parser_decl_specifier_seq, cp_parser_namespace_definition, cp_parser_init_declarator, cp_parser_type_specifier_seq, cp_parser_parameter_declaration, cp_parser_gnu_attributes_opt): Use it. (cp_parser_member_declaration, cp_parser_objc_class_ivars, cp_parser_objc_struct_declaration): Likewise. Don't reset prefix_attributes if attributes is error_mark_node. 2018-01-16 Jakub Jelinek PR c++/83817 * pt.c (tsubst_copy_and_build) : If function is AGGR_INIT_EXPR rather than CALL_EXPR, set AGGR_INIT_FROM_THUNK_P instead of CALL_FROM_THUNK_P. 2018-03-02 Jason Merrill Fix MIPS16 ICE. * pt.c (type_dependent_expression_p): Check DECL_LANG_SPECIFIC. 2018-02-27 Jason Merrill PR c++/84489 - dependent default template argument * pt.c (type_unification_real): Handle early substitution failure. 2018-03-01 Jason Merrill PR c++/71569 - decltype of template. * parser.c (cp_parser_decltype_expr): Handle missing template args. 2018-03-01 Jason Merrill Alexandre Oliva PR c++/71569 - ICE with redundant args on member variable template. * decl.c (start_decl): Handle partial specialization of member variable template. * pt.c (determine_specialization): Allow partial specialization of member variable template without specializing enclosing class. (process_partial_specialization): Improve error message. 2018-02-28 Jason Merrill PR c++/71784 - ICE with ref-qualifier and explicit specialization. * pt.c (determine_specialization): Check ref-qualifier. 2018-02-27 Jason Merrill PR c++/84496 - ICE with generic lambda in lambda. * pt.c (type_dependent_expression_p): Fix dependency checking of functions without DECL_TEMPLATE_INFO. 2018-02-26 Jason Merrill PR c++/84441 - ICE with base initialized from ?: * call.c (unsafe_copy_elision_p): Handle COND_EXPR. PR c++/84520 - ICE with generic lambda in NSDMI. * lambda.c (lambda_expr_this_capture): Don't look for fake NSDMI 'this' in a generic lambda instantiation. 2018-02-26 Jason Merrill Ville Voutilainen PR c++/81589 - error with is_trivially_constructible. * method.c (constructible_expr): Set cp_unevaluated. 2018-02-25 Jason Merrill PR c++/84015 - ICE with class deduction and auto template parm. * pt.c (rewrite_template_parm): Use tf_partial in first tsubst. 2018-02-19 Jonathan Wakely Backport from mainline 2017-08-29 Jason Merrill 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. 2018-02-16 Jason Merrill PR c++/84151 - unnecessary volatile load with static member. * call.c (build_new_method_call_1): Avoid loading from a volatile lvalue used as the object argument for a static member function. PR c++/81853 - using-directive and constexpr. * constexpr.c (cxx_eval_constant_expression): Handle USING_STMT. PR c++/84420 - ICE with structured binding in lambda. * lambda.c (is_capture_proxy): Check DECL_DECOMPOSITION_P. PR c++/83835 - C++17 error with constructor ctors. * call.c (build_special_member_call): Set TARGET_EXPR_DIRECT_INIT_P. PR c++/82664 - ICE with reference to function template parm. * pt.c (convert_nontype_argument_function): Avoid obfuscationg NOP_EXPRs. PR c++/82764 - C++17 ICE with empty base * class.c (build_base_field_1): Set DECL_SIZE to zero for empty base. PR c++/83227 - C++17 ICE with init-list derived-to-base conversion. * call.c (convert_like_real): Don't use the copy-list-initialization shortcut for ck_base. PR c++/84045 - ICE with typedef and noexcept. * except.c (build_noexcept_spec): Use strip_typedefs_expr. 2018-01-29 Jason Merrill PR c++/82461 - constexpr list-initialized member * constexpr.c (potential_constant_expression_1): Check TARGET_EXPR_DIRECT_INIT_P. 2018-01-26 Nathan Sidwell PR c++/82878 PR c++/78495 * call.c (build_call_a): Don't set CALL_FROM_THUNK_P for inherited ctor. * cp-gimplify.c (cp_genericize_r): Restore THUNK dereference inhibibition check removed in previous c++/78495 change. 2018-01-25 Release Manager * GCC 7.3.0 released. 2018-01-17 Jason Merrill PR c++/81843 - ICE with variadic member template. PR c++/72801 * pt.c (unify_pack_expansion): Don't try to deduce enclosing template args. PR c++/82331 - ICE with variadic partial specialization of auto * pt.c (unify) [TEMPLATE_PARM_INDEX]: Set processing_template_decl around call to tsubst. PR c++/82760 - memory corruption with aligned new. * call.c (build_operator_new_call): Update *args if we add the align_arg. 2018-01-02 Jakub Jelinek PR c++/83556 * tree.c (replace_placeholders_r): Pass NULL as last argument to cp_walk_tree instead of d->pset. If non-TREE_CONSTANT and non-PLACEHOLDER_EXPR tree has been seen already, set *walk_subtrees to false and return. (replace_placeholders): Pass NULL instead of &pset as last argument to cp_walk_tree. 2017-12-19 Marek Polacek Backported from mainline 2017-12-18 Marek Polacek PR c++/83116 * constexpr.c (cxx_eval_call_expression): Only look into constexpr_call_table if ctx->strict. 2017-12-16 Jakub Jelinek Backported from mainline 2017-12-15 Jakub Jelinek PR c++/83205 * decl.c (cp_finish_decomp): Handle the case when tsize is not error_mark_node, but doesn't fit into uhwi. Split up count != eltscnt and !tree_fits_uhwi_p (tsize) error_at calls into error_n and inform_n to handle plural forms properly. PR c++/81197 * cp-tree.h (cp_maybe_mangle_decomp): Declare. * decl.c (cp_maybe_mangle_decomp): New function. (cp_finish_decomp): Don't SET_DECL_ASSEMBLER_NAME here. * parser.c (cp_convert_range_for, cp_parser_decomposition_declaration): Call cp_maybe_mangle_decomp. * pt.c (tsubst_expr): Likewise. * mangle.c (find_decomp_unqualified_name): New function. (write_unqualified_name): Handle DECL_DECOMPOSITION_P where DECL_ASSEMBLER_NAME is already set. 2017-12-15 Jakub Jelinek PR c++/83217 * decl.c (cp_finish_decomp): If decl's type is REFERENCE_TYPE, call complete_type (TREE_TYPE (type)). Backported from mainline 2017-12-14 Jakub Jelinek PR c++/79650 * pt.c (convert_nontype_argument): Diagnose reduced_constant_expression_p expressions that aren't INTEGER_CST. 2017-12-06 Jakub Jelinek PR c++/80259 * decl2.c (grokfield): Diagnose = delete redefinition of a friend. 2017-11-27 Jakub Jelinek PR c++/81888 * parser.c (cp_parser_decomposition_declaration): Reject just BRACE_ENCLOSED_INITIALIZER_P initializers with nelts != 1 rather than all such CONSTRUCTORs, and only if is_direct_init is true. PR c++/81675 * cp-gimplify.c (cp_fold) : Don't return immediately for VOID_TYPE_P COND_EXPRs, instead fold the operands and if op0 is INTEGER_CST, ensure that both op1 and op2 are non-NULL and fall through into normal folding, otherwise just rebuild x if any op changed. 2017-11-23 Jakub Jelinek * parser.c (cp_parser_omp_declare): Change return type to bool from void, return true for declare simd. (cp_parser_pragma): Return cp_parser_omp_declare returned value rather than always false. 2017-11-20 Jakub Jelinek PR c++/82781 * constexpr.c (cxx_eval_vector_conditional_expression): New function. (cxx_eval_constant_expression) : Use it instead of cxx_eval_conditional_expression. 2017-10-30 Paolo Carlini PR c++/82085 * pt.c (tsubst_copy_and_build, [INDIRECT_REF]): For a REFERENCE_REF_P, unconditionally call convert_from_reference. 2017-10-27 Jakub Jelinek Backported from mainline 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-17 Nathan Sidwell PR c++/82560 * call.c (build_over_call): Don't pass tf_no_cleanup to nested calls. 2017-10-06 Jakub Jelinek PR c++/82299 * decl.c (reshape_init): Suppress warn_useless_cast for direct enum init. * typeck.c (convert_for_assignment): Likewise. 2017-10-05 Jason Merrill * call.c (convert_arg_to_ellipsis): Use the result of force_rvalue. 2017-10-04 Jason Merrill PR c++/82406 - C++ error with noexcept function type 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. PR c++/81525 - broken handling of auto in generic lambda. * pt.c (tsubst_decl) [VAR_DECL]: Use strip_innermost_template_args. 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-18 Jason Merrill PR c++/81236 - ICE with template-id in generic lambda * parser.c (parsing_default_capturing_generic_lambda): Don't check for enclosing template. * semantics.c (finish_qualified_id_expr): Call it. * cp-tree.h: Adjust. PR c++/80767 - unnecessary instantiation of generic lambda PR c++/82030 - ICE inheriting from multiple lambdas * 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. PR c++/80935 - wrong C++17 error with lambda * decl.c (check_for_uninitialized_const_var): Check is_instantiation_of_constexpr. PR c++/81671 - nullptr_t template parameter * pt.c (convert_nontype_argument): Fix nullptr_t check. PR c++/81525 - wrong constant value with generic lambda * pt.c (tsubst_decl) [VAR_DECL]: Avoid clobbering auto. (tsubst_copy) [VAR_DECL]: Handle auto. 2017-09-15 Jakub Jelinek Backported from mainline 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-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-01 Marek Polacek Backported from mainline 2017-09-01 Marek Polacek PR c++/82040 * typeck.c (cp_build_unary_op): Avoid re-entering reporting routines. 2017-08-25 Marek Polacek Backported from mainline 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-14 Release Manager * GCC 7.2.0 released. 2017-08-09 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-27 Paolo Carlini PR c++/71570 * lambda.c (add_capture): Early return if we cannot capture by reference. 2017-07-17 Jakub Jelinek Backported from mainline 2017-07-04 Jakub Jelinek PR c++/81258 * parser.c (cp_parser_decomposition_declaration): Diagnose invalid forms of structured binding initializers. 2017-07-06 Jason Merrill PR c++/81204 - parse error with dependent template-name * parser.c (cp_parser_lookup_name): Revert previous change. 2017-06-30 Jason Merrill PR c++/54769 - wrong lookup of dependent template-name. PR c++/81257 - ICE with invalid ::template. * parser.c (cp_parser_template_name): Handle dependent object type. (cp_parser_nested_name_specifier_opt): Make template_keyword_p a parameter. (cp_parser_id_expression): Pass it. 2017-06-29 Jason Merrill 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. 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-28 Jason Merrill 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++/81204 - parse error with dependent template-name * parser.c (cp_parser_lookup_name): Disqualify function templates after lookup. 2017-06-26 Jason Merrill PR c++/81215 * pt.c (unify_bound_ttp_args): Restore old logic for C++14 and down. 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-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. Backported from mainline 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-20 Jason Merrill PR c++/80972 - C++17 ICE with attribute packed. * call.c (build_over_call): Allow a TARGET_EXPR from reference binding. 2017-06-19 Jason Merrill PR c++/80562 - ICE with constexpr if. * semantics.c (finish_if_stmt_cond): Call instantiate_non_dependent_expr. PR c++/80829 - ICE with constexpr copy of base subobject. * constexpr.c (clear_no_implicit_zero): New. (cxx_eval_call_expression): Call it. PR c++/81073 - constexpr and static var in statement-expression. * constexpr.c (cxx_eval_constant_expression) [DECL_EXPR]: Check potential_constant_expression. 2017-06-17 Jason Merrill PR c++/60063 - -Wunused-local-typedefs and templates. * decl2.c (is_late_template_attribute): Return false for "used". PR c++/70844 - -Wuseless-cast and inheriting constructor. * method.c (forward_parm): Suppress warn_useless_cast. 2017-06-16 Jason Merrill PR c++/81045 - Wrong type-dependence with auto return type. * pt.c (type_dependent_expression_p): An undeduced auto outside the template isn't dependent. * call.c (build_over_call): Instantiate undeduced auto even in a template. PR c++/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. 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++/80384 - ICE with dependent noexcept-specifier * pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent noexcept-specifier. * 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. * constexpr.c (potential_constant_expression_1): Allow 'this' capture. 2017-06-08 Jakub Jelinek PR c/81006 * semantics.c (handle_omp_array_sections_1): Convert TYPE_MAX_VALUE to sizetype before size_binop. PR c++/81011 * cp-gimplify.c (cxx_omp_finish_clause): When changing clause to OMP_CLAUSE_SHARED, also clear OMP_CLAUSE_SHARED_FIRSTPRIVATE and OMP_CLAUSE_SHARED_READONLY flags. 2017-06-05 Volker Reichelt * parser.c (cp_parser_base_specifier): Fix typos in error messages. 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. 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. PR c++/80605 - __is_standard_layout and zero-length array * class.c (check_bases): Use DECL_FIELD_IS_BASE. PR c++/80605 - __is_standard_layout and empty base * class.c (check_bases): Ignore empty bases. 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. PR c++/80179 - ICE with initialized flexible array member. * constexpr.c (verify_ctor_sanity): Handle flexible array members. 2017-05-29 Alexandre Oliva * cp-tree.h (lang_identifier): Drop oracle_looked_up, unused. 2017-05-02 Release Manager * GCC 7.1.0 released. 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 Jakub Jelinek PR middle-end/80423 * tree.c (build_cplus_array_type): Call build_array_type with the intended TYPE_TYPELESS_STORAGE flag value, instead of calling build_array_type and modifying later TYPE_TYPELESS_STORAGE on the shared type. 2017-04-18 Marek Polacek PR c++/80244 - ICE with attribute in template alias. * tree.c (strip_typedefs): Handle UNDERLYING_TYPE. PR c++/80241 - ICE with alignas pack expansion. * error.c (dump_expr): Handle TREE_LIST. * parser.c (cp_parser_std_attribute_list): Return error_mark if make_pack_expansion returns an error. 2017-04-17 Bernd Edlinger PR c++/80287 * class.c (fixup_may_alias): Fix all type variants. 2017-04-17 Jason Merrill PR c++/80415 - wrong error with default arg and array reference. * tree.c (lvalue_kind): Return clk_class for an array prvalue. * pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P. 2017-04-15 Alexandre Oliva * decl.c (name_unnamed_type): Split out of... (grokdeclarator): ... this. * decl.h (name_unnamed_type): Declare. 2017-04-12 Richard Biener Bernd Edlinger PR middle-end/79671 * tree.c (build_cplus_array_type): Set TYPE_TYPELESS_STORAGE for arrays of character or std::byte type. 2017-04-11 Jason Merrill PR c++/80294 - ICE with constexpr and inheritance. * constexpr.c (reduced_constant_expression_p): A null constructor element is non-constant. (cxx_eval_indirect_ref): Don't VERIFY_CONSTANT before returning an empty base. 2017-04-11 Jakub Jelinek PR c++/80370 * decl.c (cp_finish_decomp): If processing_template_decl on non-dependent decl, only set TREE_TYPE on the v[i] decls, but don't change their DECL_VALUE_EXPR nor cp_finish_decl them. Instead make sure DECL_VALUE_EXPR is the canonical NULL type ARRAY_REF for tsubst processing. * pt.c (value_dependent_expression_p) : For variables with DECL_VALUE_EXPR, return true if DECL_VALUE_EXPR is type dependent. 2017-04-11 Jakub Jelinek PR c++/80363 * error.c (dump_expr): Handle VEC_COND_EXPR like COND_EXPR. 2017-04-10 Jakub Jelinek PR c++/80176 * tree.c (lvalue_kind): For COMPONENT_REF with BASELINK second operand, if it is a static member function, recurse on the BASELINK. 2017-04-10 Marek Polacek PR sanitizer/80348 * typeck.c (cp_build_binary_op): Use NULL_TREE instead of NULL. Set ORIG_TYPE earlier and not only when shortening. 2017-04-07 Jason Merrill PR c++/80356 - ICE with reference to function template argument. PR c++/79294 * pt.c (convert_nontype_argument_function): Adjust type even with a value-dependent argument. PR c++/80267 - ICE with nested capture of reference PR c++/60992 * pt.c (tsubst_copy): Handle lookup finding a capture proxy. 2017-04-07 Marek Polacek PR sanitizer/80348 * typeck.c (cp_build_binary_op): Convert COP[01] to ORIG_TYPE. PR c++/80095 * call.c (build_over_call): Don't check cxx_dialect. * cp-gimplify.c (cp_gimplify_init_expr): Don't check cxx_dialect nor whether SUB is a CONSTRUCTOR. * init.c (build_new_1): Don't check cxx_dialect. * tree.c (replace_placeholders): Add a function comment. Return if not in C++14, or if the object isn't a (member of a) class. * typeck2.c (store_init_value): Don't check cxx_dialect nor whether TYPE is CLASS_TYPE_P. 2017-04-05 Jakub Jelinek PR c++/80309 * pt.c (canonical_type_parameter): Use vec_safe_grow_cleared instead of a loop doing vec_safe_push of NULL. Formatting fixes. (rewrite_template_parm): Copy TEMPLATE_PARM_PARAMETER_PACK from oldidx to newidx before calling canonical_type_parameter on newtype. 2017-04-04 Volker Reichelt PR c++/80296 * cxx-pretty-print.c (cxx_pretty_printer::expression): Add UNARY_PLUS_EXPR case. 2017-04-03 Jason Merrill * semantics.c (finish_template_type): Check CLASSTYPE_TEMPLATE_INFO. 2017-04-03 Jonathan Wakely * class.c (update_vtable_entry_for_fn): Fix typo in comment. * decl2.c (one_static_initialization_or_destruction): Likewise. * name-lookup.c (store_bindings): Likewise. * parser.c (make_call_declarator): Likewise. * pt.c (check_explicit_specialization): Likewise. 2017-04-03 Jason Merrill PR sanitizer/79993 - ICE with VLA initialization from string PR c++/69487 - wrong VLA initialization from string * init.c (finish_length_check): Split out from build_vec_init. (build_vec_init): Handle STRING_CST. * typeck2.c (split_nonconstant_init): Handle STRING_CST. (digest_init_r): Don't give a STRING_CST VLA type. 2017-03-31 Jakub Jelinek PR c++/79572 * cp-gimplify.c (cp_genericize_r): Sanitize INTEGER_CSTs with REFERENCE_TYPE. Adjust ubsan_maybe_instrument_reference caller for NOP_EXPR to REFERENCE_TYPE. PR libstdc++/80251 * cp-tree.h (enum cp_trait_kind): Add CPTK_IS_AGGREGATE. * cxx-pretty-print.c (pp_cxx_trait_expression): Handle CPTK_IS_AGGREGATE. * semantics.c (trait_expr_value): Handle CPTK_IS_AGGREGATE. Remove extraneous parens. (finish_trait_expr): Handle CPTK_IS_AGGREGATE. * parser.c (cp_parser_primary_expression): Handle RID_IS_AGGREGATE. (cp_parser_trait_expr): Likewise. 2017-03-27 Jakub Jelinek PR middle-end/80162 * cp-tree.h (cxx_mark_addressable): Add array_ref_p argument. * typeck.c (cxx_mark_addressable): Likewise. Look through VIEW_CONVERT_EXPR unless array_ref_p and VCE is from VECTOR_TYPE to ARRAY_TYPE. (cp_build_array_ref): Pass true as array_ref_p to cxx_mark_addressable. 2017-03-24 Jason Merrill PR c++/77339 - ICE with invalid use of alias template. * pt.c (lookup_template_class_1): Don't try to enter the scope of an alias template. 2017-03-24 Marek Polacek PR c++/80119 * cp-gimplify.c (cp_fold): Strip CLEANUP_POINT_EXPR if the expression doesn't have side effects. 2017-03-23 Jason Merrill PR c++/80150 - ICE with overloaded variadic deduction. * pt.c (try_one_overload): Remove asserts. PR c++/77563 - missing ambiguous conversion error. * call.c (convert_like_real): Use LOOKUP_IMPLICIT. 2017-03-23 Marek Polacek * cp-tree.h: Remove a C_RID_YYCODE reference. 2017-03-22 Jakub Jelinek PR c++/80141 * semantics.c (finish_omp_clause) : Call maybe_constant_value only when not processing_template_decl. 2017-03-21 Paolo Carlini PR c++/77752 * name-lookup.c (pushtag_1): Add check for bogus, non template, std::initializer_list. 2017-03-21 Jakub Jelinek PR c++/35878 * init.c (std_placement_new_fn_p, build_new_1): Formatting fixes. 2017-03-21 Ville Voutilainen PR c++/35878 * init.c (std_placement_new_fn_p): New. (build_new_1): Call it. 2017-03-20 Jason Merrill PR c++/80096 - ICE with C++17 non-type auto. * pt.c (tsubst): Delay tsubst of type of template non-type parameter. PR c++/79519 - ICE with deleted template friend. * decl.c (grokdeclarator): Complain about misplaced function definition using =, as well. PR c++/79640 - infinite recursion with generic lambda. * pt.c (tsubst_copy) [VAR_DECL]: Register the dummy instantiation before substituting its initializer. 2017-03-20 Marek Polacek Paolo Carlini PR c++/80059 - ICE with noexcept and __transaction_atomic * except.c (build_must_not_throw_expr): Call instantiate_non_dependent_expr. 2017-03-19 Jason Merrill PR c++/80084 - wrong C++17 decomposition by reference of parameter. * decl.c (cp_finish_decomp): Don't pull out the DECL_INITIAL of a reference decomposition. PR c++/80077 - error with constexpr and -fno-elide-constructors. * constexpr.c (cxx_eval_call_expression): Set ctx->call while expanding trivial constructor. 2017-03-17 Jason Merrill PR c++/78345 - ICE initializing array from lambda. * init.c (build_aggr_init): Check array initializer. (build_vec_init): Check the type of a CONSTRUCTOR. PR c++/80073 - C++17 ICE with virtual base. * decl.c (xref_basetypes): Also check for indirect vbases. 2017-03-16 Jason Merrill * decl.c (start_enum): std::byte aliases anything. PR c++/79797 * constexpr.c (lookup_placeholder): Tweak. 2017-03-15 Jason Merrill PR c++/80043 - ICE with -fpermissive * typeck.c (convert_for_assignment): Handle instantiate_type not giving an error. 2017-03-14 Nathan Sidwell PR c++/79393 DR 1658 workaround * method.c (synthesized_method_base_walk): Inihibit abstract class virtual base access check here. (synthesized_method_walk): Not here. 2017-03-13 Nathan Sidwell PR c++/79393 DR 1658 workaround * method.c (synthesized_method_walk): Check vbases of abstract classes for dtor walk. 2017-03-10 David Malcolm PR translation/79848 * decl.c (grokfndecl): Simplify uses of "%<%s%>" to "%qs". 2017-03-10 Jason Merrill PR c++/79960 - alias templates and partial ordering * pt.c (comp_template_args): Add partial_order parm. (template_args_equal): Likewise. (comp_template_args_porder): New. (get_partial_spec_bindings): Use it. 2017-03-10 Marek Polacek PR c++/79967 * decl.c (grokdeclarator): Check ATTRLIST before dereferencing it. 2017-03-10 Jakub Jelinek PR c++/79899 * optimize.c (maybe_thunk_body): Don't ICE if fns[0] is NULL. Use XALLOCAVEC macro. PR c++/79896 * decl.c (finish_enum_value_list): If value is error_mark_node, don't copy it and change its type. * init.c (constant_value_1): Return error_mark_node if DECL_INITIAL of CONST_DECL is error_mark_node. 2017-03-09 Marek Polacek PR c++/79900 - ICE in strip_typedefs * tree.c (strip_typedefs): Skip the attribute handling if T is a variant type which hasn't been updated yet. PR c++/79687 - wrong code with pointer-to-member * init.c (constant_value_1): Break if the variable has a dynamic initializer. 2017-03-08 Jason Merrill PR c++/79797 - ICE with self-reference in array DMI. * constexpr.c (lookup_placeholder): Split out... (cxx_eval_constant_expression): ...from here. 2017-03-07 Jakub Jelinek PR c/79834 * parser.c (cp_parser_omp_cancellation_point, cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data, cp_parser_omp_target_update): Change "may only be used in compound statements" diagnostics, such that the same translatable string is used for all pragmas. (cp_parser_pragma): Likewise. Use error_at instead of cp_parser_error for that diagnostics. 2017-03-06 Marek Polacek PR c++/79796 - ICE with NSDMI and this pointer * call.c (build_over_call): Handle NSDMI with a 'this' by calling replace_placeholders. 2017-03-06 Jakub Jelinek PR c++/79822 * constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like ({ (void) 0; }). 2017-03-06 Jason Merrill Revert "Allow deduction guides to look into primary template." * cp-tree.h, parser.c, pt.c, search.c: Revert. 2017-03-05 Paolo Carlini PR c++/70266 * except.c (build_must_not_throw_expr): Perform the implicit conversions on the condition. 2017-03-03 Jason Merrill * mangle.c (mangle_decl): Check -Wnoexcept-type instead of -Wc++1z-compat. Core issues 2273 and 2277 * call.c (joust): Adjust using-declaration tiebreaker to handle the intermediate base case. * method.c (strip_inheriting_ctors): Just return the argument if !flag_new_inheriting_ctors. 2017-03-03 Richard Biener PR c++/79825 * cp-gimplify.c (simple_empty_class_p): Handle EMPTY_CLASS_EXPR. 2017-03-03 Marek Polacek PR c++/79791 * typeck.c (string_conv_p): In C++11, always call pedwarn with OPT_Wwrite_strings. 2017-03-02 Jason Merrill Update overload resolution with deduction guides. * pt.c (do_class_deduction): Always build the copy guide. (copy_guide_p, template_guide_p): New. (build_deduction_guide): Remember the original constructor. * call.c (joust): Prefer the copy guide and non-template guides. Allow deduction guides to look into primary template. * cp-tree.h (struct saved_scope): Add deduction_guide_type. (struct cp_decl_specifier_seq): Add constructor_p. * parser.c (cp_parser_decl_specifier_seq): Set constructor_p. (cp_parser_init_declarator): Check it. Set ctor_dtor_or_conv_p. Clear deduction_guide_type. Don't handle deduction guide names. (cp_parser_declarator): Don't clear ctor_dtor_or_conv_p. (cp_parser_direct_declarator): Likewise. Handle deduction guides. (cp_parser_member_declaration, cp_parser_cache_defarg) (cp_parser_objc_class_ivars): Set ctor_dtor_or_conv_p. * pt.c (tsubst_copy, tsubst_copy_and_build): Revert last change. (build_deduction_guide): Set deduction_guide_type. (dependent_scope_p): Check deduction_guide_type. * search.c (lookup_member): Likewise. 2017-03-02 Jakub Jelinek PR c++/79782 * init.c (mark_exp_read_r): New function. (emit_mem_initializers): Use cp_walk_tree with mark_exp_read_r on whole arguments instead of plain mark_exp_read on TREE_LIST values. 2017-03-01 Jason Merrill Class template argument deduction in new-expression * init.c (build_new): Handle deduction from no initializer. * parser.c (cp_parser_new_expression): Don't require a single expression for class template deduction. * typeck2.c (cxx_incomplete_type_diagnostic): Fix diagnostic for class template placeholder. * pt.c (tsubst_copy) [TEMPLATE_DECL]: Handle dependent context. (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle SCOPE_REF. (redeclare_class_template): Set TEMPLATE_TYPE_PARM_FOR_CLASS. 2017-03-01 Jakub Jelinek PR c++/79746 * init.c (emit_mem_initializers): When not constructing vbases of abstract classes, mark arguments as read for -Wunused-but-set-parameter. 2017-02-28 Jason Merrill Class template argument deduction refinements * call.c (joust): Move deduction guide tiebreaker down. * decl.c (start_decl_1, cp_finish_decl, grokdeclarator): Allow class deduction with no initializer. * pt.c (build_deduction_guide): Handle implicit default/copy ctor. (do_class_deduction): Use that rather than special case. (do_auto_deduction): Handle null initializer. 2017-02-28 Jakub Jelinek * decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...") instead of just cond ? "..." : "...". (grokdeclarator): Likewise. (build_enumerator): Likewise. * init.c (build_new_1): Likewise. * call.c (build_new_method_call_1): Likewise. * parser.c: Include intl.h. (cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for "enter"/"exit" keyword. (cp_finalize_oacc_routine): Don't use %s to supply portions of the message. 2017-02-27 Jason Merrill PR c++/71568 - SFINAE forming pointer to member function * init.c (build_offset_ref): Check the return value of perform_or_defer_access_check. 2017-02-27 Marek Polacek * decl.c (expand_static_init): Add missing } in a comment. 2017-02-27 Volker Reichelt * init.c: Include intl.h. (build_new_1): Move message strings into pedwarn to make them -Wformat-security friendly. Mark string for translation. * pt.c (tsubst_copy_and_build): Mark string for translation. Make the pointer const. * semantics.c (finish_id_expression): Mark strings for translation. 2017-02-25 Jakub Jelinek * call.c (build_op_delete_call): Make msg1 and msg2 const. 2017-02-24 Jakub Jelinek PR c++/79588 * call.c (build_over_call): Call check_function_arguments even for -Wrestrict, adjust check_function_arguments caller. * parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict here. * typeck.c (cp_build_function_call_vec): Adjust check_function_arguments caller. 2017-02-24 Marek Polacek PR translation/79705 * decl.c (check_redeclaration_exception_specification): Mark a string for translation. Make the pointer const. 2017-02-23 Paolo Carlini PR c++/79361 * pt.c (register_specialization): Check duplicate_decls return value for error_mark_node and pass it back. 2017-02-22 Jason Merrill PR c++/79679 - missing destructor for argument * call.c (build_over_call): Don't pass tf_no_cleanup to argument conversions. * pt.c (do_class_deduction): Handle 0 argument case. 2017-02-22 Jakub Jelinek PR c++/79664 * parser.c (cp_parser_omp_teams, cp_parser_omp_target): Use SET_EXPR_LOCATION on OMP_TARGET/OMP_TEAMS tree. * constexpr.c (potential_constant_expression_1): Handle OMP_*, OACC_* and CILK_* trees. Use error_at with EXPR_LOC_OR_LOC (t, input_location) computed early instead of error, or error_at with location_of (t). 2017-02-22 Marek Polacek PR c++/79653 * parser.c (cp_parser_std_attribute_spec): Don't build the attribute if the alignas expression is erroneous. * pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return error_mark_node. PR c++/79657 * semantics.c (finish_underlying_type): Bail out for incomplete enums. 2017-02-21 Jason Merrill PR c++/50308 - wrong deprecated warning with ADL PR c++/17729 - duplicate deprecated warning * semantics.c (finish_id_expression): Only call mark_used on a function if we aren't building a call. PR c++/41727 - ICE with partial spec of partial instantiation * pt.c (process_partial_specialization): For now, don't check more specialized if there is more than one level of args. 2017-02-21 Marek Polacek PR c++/79535 * cp-tree.h (maybe_reject_flexarray_init): Declare. * init.c (maybe_reject_flexarray_init): No longer static. Add check for current_function_decl. * parser.c (cp_parser_late_parse_one_default_arg): Reject a default mem-initializer for a flexible array. 2017-02-21 Jakub Jelinek Paolo Carlini PR c++/79654 * decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node on error. * pt.c (tsubst_decomp_names): Return error_mark_node if the first decl after the decomposition artificial decl has error_mark_node. * decl2.c (prune_vars_needing_no_initialization): Use error_operand_p instead of just == error_mark_node comparison. 2017-02-21 Jakub Jelinek PR sanitizer/79589 * decl.c: Include gimplify.h. (cp_finish_decomp): Make sure there is no sharing of trees in between DECL_VALUE_EXPR of decomposition decls. PR c++/79655 * constexpr.c (cxx_eval_array_reference): Diagnose negative subscript. PR c++/79639 * constexpr.c (cxx_eval_store_expression): If *valp is a PTRMEM_CST, call cplus_expand_constant on it first. 2017-02-19 Jason Merrill PR c++/78139 - destructor needed by new-expression * call.c (build_special_member_call): Use tf_no_cleanup. PR c++/78282 - auto template and pack expansion * pt.c (find_parameter_packs_r): Don't walk into the type of templates other than template template-parameters. PR c++/79606 - ICE with this->base_member in NSDMI * class.c (build_base_path): Check processing_template_decl. PR c++/79607 - ICE with T{} initializer * decl.c (type_dependent_init_p): Check the type of a CONSTRUCTOR. PR c++/79566 - elaborated-type-specifier in range for * parser.c (cp_parser_simple_declaration): Fix check for type definition. PR c++/79400 - confusing suggestion of 'noexcept' * parser.c (cp_parser_exception_specification_opt): Remove suggestion for deprecated dynamic exception-specification. PR c++/79470 - partial ordering with reference parameters * pt.c (unify) [INDIRECT_REF]: Handle pack expansions. PR c++/79500 - ICE with non-template deduction guide * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than DECL_TEMPLATE_RESULT. PR c++/79580 - ICE with compound literal * parser.c (cp_parser_class_head): If we're in the middle of an expression, use ts_within_enclosing_non_class. PR c++/79503 - inherited ctor taking base class * call.c (add_function_candidate): Also check that DECL_INHERITED_CTOR_BASE is reference-related to the parameter type. 2017-02-19 Paolo Carlini PR c++/79380 * typeck.c (cxx_alignas_expr): Reject a non-integral alignas argument. 2017-02-19 Eric Fiselier Jonathan Wakely PR c++/69523 * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to control warning about literal suffix identifiers without a leading underscore. 2017-02-17 Jason Merrill PR c++/79508 - lookup error with member template * parser.c (cp_parser_template_name): Clear parser->context->object_type if we aren't doing lookup. PR c++/78690 - ICE with using and global type with same name * pt.c (type_dependent_object_expression_p): True for IDENTIFIER_NODE. PR c++/79549 - C++17 ICE with non-type auto template parameter pack * pt.c (convert_template_argument): Just return an auto arg pack. (tsubst_template_args): Don't tsubst an auto pack type. PR c++/79556 - C++17 ICE with non-type auto * pt.c (do_auto_deduction): Don't try to deduce from null type. PR c++/79533 - C++17 ICE with temporary cast to reference * call.c (build_over_call): Conversion to a reference prevents copy elision. 2017-02-16 Jakub Jelinek Jason Merrill PR c++/79502 - lost nodiscard attribute * pt.c (apply_late_template_attributes): Do apply non-dependent attributes to types. 2017-02-16 Jason Merrill PR c++/78572 - ICE with self-modifying array initializer * constexpr.c (cxx_eval_store_expression): The object we're initializing is outside the constant-expression. (cxx_eval_call_expression): Set ctx->call. PR c++/79050 - ICE with undeduced auto and LTO * decl.c (poplevel): Remove undeduced auto decls. 2017-02-16 Jakub Jelinek PR c++/79512 * parser.c (cp_parser_omp_target): For -fopenmp-simd ignore #pragma omp target even when not followed by identifier. 2017-02-15 Jason Merrill Jakub Jelinek PR c++/79464 - ICE in IPA with omitted constructor parms * class.c (build_clone): Also omit parms from TYPE_ARG_TYPES. (adjust_clone_args): Adjust. (add_method): Remember omitted parms. * call.c (add_function_candidate): Likewise. * mangle.c (write_method_parms): Likewise. * method.c (ctor_omit_inherited_parms): Return false if there are no parms to omit. 2017-02-15 Martin Sebor PR c++/79363 * init.c (maybe_reject_flexarray_init): New function. (perform_member_init): Call it. 2017-02-15 Jakub Jelinek PR c++/79301 * parser.c (cp_parser_std_attribute): Don't pedwarn about [[deprecated]] with -std=c++11 and [[fallthrough]] with -std=c++11 and -std=c++14. PR c++/79288 * decl.c (grokdeclarator): For static data members, handle thread_p only after handling inline. 2017-02-14 Marek Polacek PR c++/79420 PR c++/79463 * parser.c (cp_parser_postfix_dot_deref_expression): Avoid clobbering if the postfix expression isn't an EXPR_P. 2017-02-13 Jason Merrill PR c++/79461 - ICE with lambda in constexpr constructor * constexpr.c (build_data_member_initialization): Ignore initialization of a local variable. 2017-02-13 Jakub Jelinek * init.c (warn_placement_new_too_small): Add missing space in diagnostics. * parser.c (cp_parser_oacc_declare): Likewise. * mangle.c (maybe_check_abi_tags): Likewise. PR c++/79232 * typeck.c (cp_build_modify_expr): Handle properly COMPOUND_EXPRs on lhs that have {PRE{DEC,INC}REMENT,MODIFY,MIN,MAX,COND}_EXPR in the rightmost operand. 2017-02-13 Nathan Sidwell PR c++/79296 - ICE mangling localized template instantiation * decl2.c (determine_visibility): Use template fn context for local class instantiations. 2017-02-11 Jason Merrill PR c++/77659 - ICE with new and C++14 aggregate NSDMI * init.c (build_new): Make backups of any CONSTRUCTORs in init. (build_new_1): Use replace_placeholders. * tree.c (replace_placeholders_t): Also track whether we've seen a placeholder. (replace_placeholders, replace_placeholders_r): Adjust. * cp-tree.h: Adjust. PR c++/77790 - ICE with auto function in C++11 mode * decl.c (undeduced_auto_decl): Remove C++14 limitation. (require_deduced_type): Add complain parm, return bool. * cp-tree.h: Adjust. * decl2.c (mark_used): Use require_deduced_type. 2017-02-10 Jason Merrill PR c++/78908 - template ops and bitfields * tree.c (build_min_non_dep): Use unlowered_expr_type. PR c++/78897 - constexpr union * constexpr.c (cxx_eval_store_expression): A store to a union member erases a previous store to another member. PR c++/71285 - member of fold-expression * semantics.c (finish_unary_fold_expr) (finish_binary_fold_expr): Use null type for fold-expressions. PR c++/79401 - protected inherited constructor * call.c (enforce_access): For inheriting constructor, find a base binfo in the path we already have. 2017-02-10 Marek Polacek PR c++/79435 * pt.c (type_dependent_expression_p): Check if the expression type is null. PR c++/79184 * cvt.c (ocp_convert): Add a sentinel against -Wint-in-bool-context if warnings shouldn't be given. 2017-02-10 Paolo Carlini PR c++/71737 * pt.c (tsubst_decl): Don't try to preserve a typedef that names an error_mark_node as type. 2017-02-09 Jakub Jelinek Jason Merrill PR c++/79143 * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE from pattern to type. 2017-02-09 Jason Merrill PR c++/79316 - default argument in deduction guide PR c++/79350 - explicit deduction guide * parser.c (cp_parser_constructor_declarator_p) (cp_parser_direct_declarator): Parse deduction guides more like constructors. * cp-tree.h (enum special_function_kind): Add sfk_deduction_guide. * tree.c (special_function_p): Return it. * decl.c (check_special_function_return_type): Handle it. (grokdeclarator, grokfndecl): Adjust. (cp_finish_decl): Pass flags to do_auto_deduction. * error.c (dump_decl_name): Use TFF_UNQUALIFIED_NAME. * pt.c (dguide_name_p): Take a const_tree. (do_class_deduction): Handle explicit. (do_auto_deduction): Pass flags through. (build_deduction_guide): Copy explicit flag. 2017-02-09 Jakub Jelinek PR c++/79429 * parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt non-pragma_compound context here. (cp_parser_omp_target): Likewise. (cp_parser_pragma): Don't call push_omp_privatization_clauses and parsing for ordered and target omp pragmas in non-pragma_stmt non-pragma_compound contexts. PR c/79431 * parser.c (cp_parser_oacc_declare): Formatting fix. (cp_parser_omp_declare_target): Don't invoke symtab_node::get on automatic variables. 2016-02-09 Nathan Sidwell Chung-Lin Tang * parser.c (cp_parser_oacc_clause_tile): Disallow collapse. Fix parsing. Parse constant expression. Remove semantic checking. (cp_parser_omp_clause_collapse): Disallow tile. (cp_parser_omp_for_loop): Deal with tile clause. Don't emit a parse error about missing for after already emitting one. Use more conventional for idiom for unbounded loop. * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE. * semantics.c (finish_omp_clauses): Correct TILE semantic check. (finish_omp_for): Deal with tile clause. 2017-02-07 Nathan Sidwell * method.c (synthesized_method_base_walk): New. Broken out of ... (synthesized_method_walk): ... here. Call it. Cleanup initializations. 2017-02-07 Patrick Palka PR c++/79360 * typeck2.c (process_init_constructor_union): Consider only FIELD_DECLs when looking for an NSDMI. 2017-02-06 Jason Merrill PR c++/71193 - incomplete types in templates * parser.c (cp_parser_postfix_dot_deref_expression): In a template handle incomplete type by pedwarning and then treating as dependent. 2017-02-06 Jakub Jelinek PR c++/79379 * constexpr.c (cxx_eval_constant_expression): Handle ANNOTATE_EXPR. (potential_constant_expression_1): Likewise. PR c++/79377 * tree.c (build_min_non_dep_op_overload): For POST{INC,DEC}REMENT_EXPR allow one fewer than expected arguments if flag_permissive. PR c++/79372 * decl.c (cp_finish_decomp): On error set decl type to error_mark_node. * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions with error_mark_node type. 2017-02-03 Jason Merrill PR c++/78689 - ICE on constructor with label * optimize.c (maybe_clone_body): Replace omitted parameters with null lvalues. * class.c (build_clone): Fix logic for omitting inherited parms. PR c++/12245 - excessive memory use * constexpr.c (maybe_constant_value): Fold maybe_constant_value_1 back in. Don't cache constants. (maybe_constant_init): Don't cache constants. PR c++/79294 - ICE with invalid template argument * pt.c (convert_nontype_argument_function): Check value-dependence. (convert_nontype_argument): Don't check it here for function ptrs. 2017-02-02 Richard Biener PR cp/14179 * cp-gimplify.c (cp_fold): When folding a CONSTRUCTOR copy it lazily on the first changed element only and copy it fully upfront, only storing changed elements. 2017-02-02 Paolo Carlini PR c++/69637 * decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL to the width. 2017-01-31 Jakub Jelinek PR c++/79304 * error.c (dump_expr) : Don't print . after ARROW_EXPR. 2017-01-31 David Malcolm PR c++/79298 * name-lookup.c (suggest_alternative_in_explicit_scope): Resolve any namespace aliases. 2017-01-31 Nathan Sidwell PR c++/79290 * typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING. PR c++/67273 PR c++/79253 * pt.c: (instantiate_decl): Push to top level when current function scope doesn't match. Only push lmabda scope stack when pushing to top. * cp-tree.h (instantiate_decl): Make defer_ok bool. * pt.c: Fix instantiate_decl calls to pass true/false not 0/1 (instantiate_decl): Simplify and reorder state saving and restoration. PR c++/79264 * lambda.c (maybe_generic_this_capture): Deal with template-id-exprs. * semantics.c (finish_member_declaration): Assert class is being defined. 2017-01-30 Alexandre Oliva Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. 2017-01-27 Jason Merrill PR c++/78771 - ICE with inherited constructor. * call.c (build_over_call): Call deduce_inheriting_ctor here. * pt.c (tsubst_decl): Not here. * class.c (add_method): Or here. * method.c (deduce_inheriting_ctor): Handle clones. (implicitly_declare_fn): Don't deduce inheriting ctors yet. 2017-01-27 Adam Butcher PR c++/64382 * cp/parser.c (parsing_default_capturing_generic_lambda_in_template): New function. * cp/cp-tree.h: Declare it. * cp/semantics.c (finish_id_expression): Resolve names within a default capturing generic lambda defined within a template prior to instantiation to allow for captures to be added to the closure type. 2017-01-26 Jakub Jelinek PR c++/68727 * cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2. * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument. * parser.c (cp_parser_builtin_offsetof): Pass result of build_static_cast of null_pointer_node to finish_offsetof. * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use it for -Winvalid-offsetof pedwarn instead of trying to guess original offsetof type from EXPR. Save OBJECT_PTR as a new second operand to OFFSETOF_EXPR. * pt.c (tsubst_copy_and_build) : Adjust finish_offsetof caller, pass the second operand of OFFSETOF_EXPR as OBJECT_PTR. 2017-01-26 Jason Merrill * name-lookup.c (parse_using_directive): Deprecate strong using. PR c++/79176 - lambda ICE with -flto -Os * decl2.c (vague_linkage_p): Handle decloned 'tors. * tree.c (decl_linkage): Likewise. 2017-01-25 Martin Sebor * decl.c (grokdeclarator): Fix a typo in a comment. 2017-01-25 Jakub Jelinek PR c++/78896 * decl.c (cp_finish_decomp): Disallow memberwise decomposition of lambda expressions. PR c++/77914 * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with OPT_Wpedantic on lambda templates for -std=c++14 and higher. 2017-01-25 Maxim Ostapenko PR lto/79061 * decl.c (cxx_init_decl_processing): Pass main_input_filename to build_translation_unit_decl. 2017-01-24 Jakub Jelinek PR c++/79205 * cp-gimplify.c (cp_genericize_r): Add result of convert_from_reference on invisiref parm to p_set. 2017-01-24 Nathan Sidwell PR c++/78469 - defaulted ctor and inaccessible dtor * cp-tree.h (tsubst_flags): Add tf_no_cleanup. * init.c (build_new_1): Pass tf_no_cleanup to build_value_init. * tree.c (build_target_expr): Check tf_no_cleanup. PR c++/79118 - anon-members and constexpr * constexpr.c (cx_check_missing_mem_inits): Caller passes type not ctor decl. Recursively check anonymous members. (register_constexpr_fundef): Adjust cx_check_missing_mem_inits call. (explain_invalid_constexpr_fn): Likewise. 2017-01-23 Nathan Sidwell PR c++/71710 - template using directive of field * pt.c (tsubst_copy_and_build [COMPONENT_REF]): Move FIELD_DECL check earlier. PR c++/71406 - ICE with scope-ref'd template id exprs PR c++/77508 * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF before breaking up TEMPLATE_ID_EXPR. 2017-01-20 Nathan Sidwell PR c++/78495 - wrong code inherited ctor and invisi-ref parm * cp-gimplify.c (cp_generize_r): Don't skip thunks. 2017-01-20 David Malcolm PR c++/77829 PR c++/78656 * cp-tree.h (suggest_alternatives_for): Add bool param. (suggest_alternative_in_explicit_scope): New decl. * error.c (qualified_name_lookup_error): When SCOPE is a namespace that isn't the global one, call new function suggest_alternative_in_explicit_scope, only calling suggest_alternatives_for if it fails, and disabling near match searches fort that case. When SCOPE is the global namespace, pass true for new param to suggest_alternatives_for to allow for fuzzy name lookups. * lex.c (unqualified_name_lookup_error): Pass true for new param to suggest_alternatives_for. * name-lookup.c (consider_binding_level): Add forward decl. (suggest_alternatives_for): Add "suggest_misspellings" param, using it to conditionalize the fuzzy name-lookup code. (suggest_alternative_in_explicit_scope): New function. * parser.c (cp_parser_primary_expression): When calling finish_id_expression, pass location of id_expression rather than that of id_expr_token. (cp_parser_id_expression): Convert local "unqualified_id" from tree to cp_expr to avoid implicitly dropping location information. 2017-01-20 Marek Polacek PR c/64279 * call.c (build_conditional_expr_1): Warn about duplicated branches. * semantics.c (finish_expr_stmt): Build statement using the proper location. 2017-01-19 Jason Merrill US 20 - forwarding references and class template argument deduction * cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): New. * pt.c (push_template_decl_real): Set it. (maybe_adjust_types_for_deduction): Check it. (rewrite_template_parm): Copy it. US 19 - deduction guides and constructors * call.c (joust): Prefer deduction guides to constructors. * pt.c (build_deduction_guide): Set DECL_ARTIFICIAL. (deduction_guide_p): Check DECL_P. * decl.c (check_initializer): Always use build_aggr_init for array decomposition. PR c++/79130 - decomposition and direct-initialization * init.c (build_aggr_init): Communicate direct-initialization to build_vec_init. (build_vec_init): Check for array copy sooner. * parser.c (cp_parser_decomposition_declaration): Remove call to build_x_compound_expr_from_list. 2017-01-18 Jason Merrill PR c++/68666 - member variable template-id * typeck.c (finish_class_member_access_expr): Handle variable template-id. * pt.c (lookup_and_finish_template_variable): No longer static. * cp-tree.h: Declare it. 2017-01-18 Nathan Sidwell PR c++/78488 * call.c (build_over_call): When checking ellipsis conversions for an inherited ctor, make sure there is at least one conversion. 2017-01-18 Jason Merrill PR c++/78894 - ICE with class deduction and default arg * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE. 2017-01-18 Markus Trippelsdorf PR c++/77489 * mangle.c (write_discriminator): Reorganize abi warning check. 2017-01-18 Nathan Sidwell * cp-tree.h: Clarify exception spec node comment. * except.c (nothrow_spec_p): Simplify by checking node-equality. PR c++/79091 * mangle.c (write_exception_spec): Check nothrow explicitly. (write_encoding): Don't increment processing_template_decl around encoding. 2017-01-18 Markus Trippelsdorf PR c++/70182 * mangle.c (write_template_args): Add "on" for operator names. 2017-01-18 Markus Trippelsdorf PR c++/77489 * mangle.c (write_discriminator): Handle discriminator >= 10. 2017-01-17 Nathan Sidwell PR c++/61636 * cp-tree.h (maybe_generic_this_capture): Declare. * lambda.c (resolvable_dummy_lambda): New, broken out of ... (maybe_resolve_dummy): ... here. Call it. (maybe_generic_this_capture): New. * parser.c (cp_parser_postfix_expression): Speculatively capture this in generic lambda in unresolved member function call. * pt.c (tsubst_copy_and_build): Force hard error from failed member function lookup in generic lambda. 2017-01-17 Aldy Hernandez PR c++/70565 * cp-array-notation.c (expand_array_notation_exprs): Handle OMP_PARALLEL. 2017-01-11 Jason Merrill PR c++/78337 - ICE on invalid with generic lambda * semantics.c (process_outer_var_ref): Check if containing_function is null. Move inform call under complain test. 2017-01-11 Nathan Sidwell PR c++/77812 * name-lookup.c (set_namespace_binding_1): An overload of 1 decl is a new overload. 2017-01-11 Nathan Sidwell * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation. 2017-01-11 Jakub Jelinek PR c++/78341 * parser.c (cp_parser_std_attribute_spec): Remove over-eager assertion. Formatting fix. PR c++/72813 * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after writing PCH file. 2017-01-10 David Malcolm PR c++/77949 * parser.c (cp_parser_class_specifier_1): Only suggest inserting a missing semicolon if we have a valid insertion location for the fix-it hint. 2017-01-10 Jason Merrill FI 20, decomposition declaration with parenthesized initializer. * parser.c (cp_parser_decomposition_declaration): Use cp_parser_initializer. 2017-01-09 Jason Merrill Implement P0195R2, C++17 variadic using. * parser.c (cp_parser_using_declaration): Handle ellipsis and comma. * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE. * error.c (dump_decl): Likewise. 2017-01-09 Jakub Jelinek PR translation/79019 PR translation/79020 * semantics.c (finish_omp_clauses): Add missing whitespace to translatable strings. * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo. 2017-01-07 Jason Merrill PR c++/78948 - instantiation from discarded statement * parser.h (struct cp_parser): Remove in_discarded_stmt field. * cp-tree.h (in_discarded_stmt): Declare it. (struct saved_scope): Add discarded_stmt bitfield. (in_discarded_stmt): New macro. * decl2.c (mark_used): Check it. * parser.c (cp_parser_selection_statement): Adjust. (cp_parser_jump_statement): Adjust. 2017-01-05 Jakub Jelinek PR c++/78931 * decl.c (cp_finish_decomp): Remove probe variable, if tt is REFERENCE_REF_P, set tt to its operand. PR c++/78890 * class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in unions even for C++11 and later. 2017-01-05 Nathan Sidwell PR c++/78765 * pt.c (convert_nontype_argument): Don't try and see if integral or enum expressions are constants prematurely. 2017-01-04 Marek Polacek PR c++/64767 * typeck.c (cp_build_binary_op): Warn when a pointer is compared with a zero character literal. 2017-01-04 Jakub Jelinek PR c++/78949 * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has vector type. PR c++/78693 * parser.c (cp_parser_simple_declaration): Only complain about inconsistent auto deduction if auto_result doesn't use auto. * parser.c (cp_parser_simple_declaration): Diagnose function declaration among more than one init-declarators with auto specifier. PR c++/71182 * parser.c (cp_lexer_previous_token): Use vec_safe_address in the assertion, as lexer->buffer may be NULL. 2017-01-04 Marek Polacek PR c++/77545 PR c++/77284 * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT. 2017-01-04 Nathan Sidwell PR c++/66735 * cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New. (lambda_capture_field_type): Update prototype. * lambda.c (lambda_capture_field_type): Add is_reference parm. Add referenceness here. (add_capture): Adjust lambda_capture_field_type call, refactor error checking. * pt.c (tsubst): Adjust lambda_capture_field_type call. 2017-01-01 Jakub Jelinek Update copyright years. Copyright (C) 2017 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.