2016-04-15 Jakub Jelinek PR c/70436 * parser.c (cp_parser_pragma): Add IF_P argument, pass it down where needed. (cp_parser_declaration_seq_opt, cp_parser_member_specification_opt, cp_parser_objc_interstitial_code, cp_parser_omp_declare_simd, cp_parser_oacc_routine): Adjust cp_parser_pragma callers. (cp_parser_statement): Likewise. Adjust cp_parser_cilk_for caller. (cp_parser_omp_structured_block): Add IF_P argument, pass it down to cp_parser_statement. (cp_parser_oacc_data, cp_parser_oacc_host_data, cp_parser_oacc_loop, cp_parser_oacc_kernels_parallel, cp_parser_omp_critical, cp_parser_omp_simd, cp_parser_omp_for, cp_parser_omp_master, cp_parser_omp_ordered, cp_parser_omp_parallel, cp_parser_omp_single, cp_parser_omp_task, cp_parser_omp_taskgroup, cp_parser_omp_distribute, cp_parser_omp_teams, cp_parser_omp_target_data, cp_parser_omp_target, cp_parser_omp_taskloop, cp_parser_omp_construct, cp_parser_cilk_grainsize, cp_parser_cilk_simd, cp_parser_cilk_for): Add IF_P argument, pass it down where needed. (cp_parser_omp_for_loop): Likewise. Clear IF_P if nbraces. (cp_parser_omp_sections_scope): Adjust cp_parser_omp_structured_block calls. 2016-04-14 Jason Merrill PR c++/70528 * class.c (type_has_constexpr_default_constructor): Return true for an implicitly declared constructor. PR c++/70622 * parser.c (cp_parser_init_declarator): Add auto_result parm. (cp_parser_simple_declaration): Pass it. (strip_declarator_types): New. PR c++/70543 * pt.c (value_dependent_expression_p) [VAR_DECL]: A type-dependent initializer also makes the variable value-dependent. PR c++/70648 * constexpr.c (cxx_eval_store_expression): Also copy CONSTRUCTOR_NO_IMPLICIT_ZERO. 2016-04-14 Martin Sebor PR c++/69517 PR c++/70019 PR c++/70588 * cp-tree.h, decl.c, init.c, typeck2.c: Revert. 2016-04-14 Jason Merrill * call.c, decl.c, error.c, cp-tree.h, decl.c: Revert empty parameter ABI change. 2016-04-13 Martin Sebor PR c++/69517 PR c++/70019 PR c++/70588 * cp-tree.h (throw_bad_array_length, build_vla_check): Declare new functions. * decl.c (check_initializer, cp_finish_decl): Call them. (reshape_init_r): Reject incompletely braced intializer-lists for VLAs. * init.c (throw_bad_array_length, build_vla_check) (build_vla_size_check, build_vla_init_check): Define new functions. * typeck2.c (split_nonconstant_init_1): Use variably_modified_type_p() to detect a VLA. (store_init_value): Same. 2016-04-13 Jason Merrill Warn about empty parameter ABI with -Wabi=9. * call.c (empty_class_msg, mark_for_abi_warning) (warn_empty_class_abi): New. (build_call_a): Use them. * decl.c (store_parm_decls): Use mark_for_abi_warning. * error.c (pp_format_to_string): New. Pass empty class parameters like C. * call.c (pass_as_empty_struct, empty_class_arg): New. (type_passed_as, build_x_va_arg): Use pass_as_empty_struct. (build_call_a): Use empty_class_arg. * cp-tree.h (CPTI_EMPTY_STRUCT, empty_struct_type): New. * decl.c (cxx_init_decl_processing): Create empty_struct_type. 2016-04-13 Jason Merrill PR c++/70627 * decl.c (start_enum): Don't change an existing ENUM_UNDERLYING_TYPE. 2016-04-13 Paolo Carlini PR c++/70635 * pt.c (resolve_typename_type): Fix typos in infinite recursion avoidance mechanism. 2016-04-13 Jason Merrill PR c++/70634 * pt.c (instantiation_dependent_uneval_expression_p): Split out from instantiation_dependent_expression_p. (value_dependent_expression_p): Use it for unevaluated operands. (instantiation_dependent_r): Don't check value-dependence. (instantiation_dependent_expression_p): Check value-dependence of the expression as a whole. * cp-tree.h: Declare instantiation_dependent_uneval_expression_p. * semantics.c (finish_decltype_type): Use it. * constexpr.c (potential_nondependent_constant_expression): New. (potential_nondependent_static_init_expression): New. (maybe_constant_value_1, fold_non_dependent_expr) (maybe_constant_init): Use them. * pt.c (instantiate_non_dependent_expr_sfinae) (instantiate_non_dependent_or_null, convert_nontype_argument): Use them. * cp-tree.h: Declare them. 2016-04-13 Jakub Jelinek PR c++/70594 * decl.c (pop_labels_1): Removed. (note_label, sort_labels): New functions. (pop_labels): During named_labels traversal, just push the slot pointers into a vector, then qsort it by DECL_UID and only then call pop_label and chain it into BLOCK_VARS. 2016-04-13 Jason Merrill PR c++/70615 * cp-gimplify.c (cp_genericize_r): Expand PTRMEM_CST here. (cp_gimplify_expr): Not here. 2016-04-12 Patrick Palka PR c++/70610 * tree.c (lvalue_kind) [NON_DEPENDENT_EXPR]: Unconditionally recurse into it. * typeck.c (build_x_conditional_expr): Unconditionally remember that the result is an lvalue or xvalue. 2016-04-12 Jason Merrill * class.c (is_really_empty_class): A zero-length array is empty. An unnamed bit-field doesn't make a class non-empty. 2016-04-12 Paolo Carlini PR c++/68722 * parser.c (cp_parser_cache_defarg): When file ends in default argument simply return error_mark_node. 2016-04-12 Nathan Sidwell PR c++/70501 * constexpr.c (cxx_eval_bare_aggregate): Handle VECTOR_TYPE similarly to PMF. 2016-04-11 Jason Merrill * mangle.c (decl_is_template_id): The template itself counts as a template-id. 2016-04-08 Patrick Palka PR c++/70590 PR c++/70452 * constexpr.c (cxx_eval_outermost_expression): Call unshare_expr on the result if it's not a CONSTRUCTOR. 2016-04-07 Patrick Palka PR c++/70452 * constexpr.c (find_constructor): New function. (unshare_constructor): New function. (cxx_eval_call_expression): Use unshare_constructor instead of unshare_expr. (find_array_ctor_elt): Likewise. (cxx_eval_vec_init_1): Likewise. (cxx_eval_store_expression): Likewise. (cxx_eval_constant_expression): Likewise. 2016-04-06 Patrick Palka PR c/70436 * cp-tree.h (FOR_EACH_CLONE): Restructure macro to avoid potentially generating a future -Wparentheses warning in its callers. 2016-04-06 Jason Merrill * class.c (check_abi_tags): Fix function template handling. 2016-04-05 Nathan Sidwell PR c++/70512 * class.c (fixup_may_alias): New. (fixup_attribute_variants): Call it. 2016-04-05 Patrick Palka PR c++/70452 * constexpr.c (struct fundef_copy): New struct. (struct fundef_copies_table_t): New struct. (fundef_copies_table): New static variable. (maybe_initialize_fundef_copies_table): New static function. (get_fundef_copy): New static function. (save_fundef_copy): New static function. (cxx_eval_call_expression): Use get_fundef_copy, and save_fundef_copy. (constexpr_call_table): Add "deletable" GTY marker. 2016-04-05 Patrick Palka PR c++/70452 * cp-tree.h (class cache_map): Remove. * constexpr.c (cv_cache): Change type to GTY((deletable)) hash_map *. (maybe_constant_value): Adjust following the change to cv_cache. (clear_cv_cache): New static function. (clear_cv_and_fold_caches): Use it. * cp-gimplify.c (fold_cache): Change type to GTY((deletable)) hash_map *. (clear_fold_cache): Adjust following the change to fold_cache. (cp_fold): Likewise. 2016-04-02 Martin Sebor PR c++/67376 PR c++/70170 PR c++/70172 PR c++/70228 * constexpr.c (diag_array_subscript): New function. (cxx_eval_array_reference): Detect out of bounds array indices. 2016-04-01 Jason Merrill PR c++/70449 PR c++/70344 * pt.c (instantiate_decl): A function isn't fully defined if DECL_INITIAL is error_mark_node. * constexpr.c (cxx_eval_call_expression): Likewise. 2016-04-01 Jakub Jelinek Marek Polacek PR c++/70488 * init.c (warn_placement_new_too_small): Test whether DECL_SIZE_UNIT or TYPE_SIZE_UNIT are integers that fit into uhwi. 2016-04-01 Nathan Sidwell PR c++/68475 * decl.c (check_redeclaration_exception_specification): Check regardless of -fno-exceptions. * typeck2.c (merge_exception_specifiers): Relax assert by checking flag_exceptions too. 2016-03-31 Nathan Sidwell * decl.c (start_preparsed_function): Remove unnecessary bracing. (finish_destructor_body): Don't emit operator delete here. 2016-03-31 Nathan Sidwell PR c++/70393 * constexpr.c (cxx_eval_store_expression): Keep CONSTRUCTOR elements in field order. 2016-03-31 Marek Polacek PR c/70297 * decl.c (duplicate_decls): Also set TYPE_ALIGN and TYPE_USER_ALIGN. 2016-03-31 Richard Biener PR c++/70430 * typeck.c (cp_build_binary_op): Fix operand order of vector conditional in truth op handling. 2016-03-29 Jason Merrill PR c++/70353 * decl.c (make_rtl_for_nonlocal_decl): Don't defer local statics in constexpr functions. 2016-03-28 Jason Merrill PR c++/70422 PR c++/64266 PR c++/70353 * decl.c, pt.c, constexpr.c: Revert last patch. 2016-03-25 Jason Merrill Martin Liška PR c++/64266 PR c++/70353 Core issue 1962 * decl.c (cp_fname_init): Decay the initializer to pointer. (cp_make_fname_decl): Set DECL_DECLARED_CONSTEXPR_P, DECL_VALUE_EXPR, DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. Don't call cp_finish_decl. * pt.c (tsubst_expr) [DECL_EXPR]: Set DECL_VALUE_EXPR, DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. Don't call cp_finish_decl. * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Handle DECL_VALUE_EXPR. 2016-03-24 Jason Merrill PR c++/70386 * constexpr.c (cxx_eval_bare_aggregate): Handle PMFs. PR c++/70323 * constexpr.c (cxx_eval_call_expression): Don't cache result if *overflow_p. 2016-03-24 Patrick Palka PR c++/62212 * tree.c (build_cplus_array_type): Determine type-dependentess with uses_template_parms instead of with dependent_type_p. 2016-03-23 Patrick Palka PR c++/70347 * typeck.c (process_init_constructor_union): If the initializer is empty, use the union's NSDMI if it has one. 2016-03-23 Patrick Palka PR c++/70332 * pt.c (tsubst_copy) [PARM_DECL]: Handle the use of 'this' in an NSDMI that's part of an aggregrate initialization. 2016-03-23 Jakub Jelinek PR c++/70001 * constexpr.c (cxx_eval_vec_init_1): Reuse CONSTRUCTOR initializers for 1..max even for multi-dimensional arrays. Call unshare_expr on it. PR c++/70323 * constexpr.c (cxx_eval_constant_expression): Diagnose overflow on TREE_OVERFLOW constants. PR c++/70376 * cp-gimplify.c (genericize_omp_for_stmt): Don't walk OMP_FOR_CLAUSES for OMP_TASKLOOP here. (cp_genericize_r): Handle OMP_TASKLOOP like OMP_TASK, except do call genericize_omp_for_stmt instead of cp_walk_tree on OMP_BODY. 2016-03-23 Alexandre Oliva Jason Merrill Jakub Jelinek PR c++/69315 * cp-tree.h (defer_mark_used_calls, deferred_mark_used_calls): Remove. * decl.c (defer_mark_used_calls, deferred_mark_used_calls): Remove. (finish_function): Don't set or test them. * decl2.c (mark_used): Don't handle defer_mark_used_calls. 2016-03-23 Jason Merrill PR c++/70344 * constexpr.c (cxx_eval_call_expression): Catch invalid recursion. 2016-03-23 Marek Polacek PR c++/69884 * pt.c (canonicalize_type_argument): Use OPT_Wignored_attributes. 2016-03-22 Ilya Enkovich * call.c (build_conditional_expr_1): Always use original condition type for vector type checks and build. 2016-03-22 Patrick Palka PR c++/70096 * pt.c (tsubst_decl): Clear the DECL_MODE of the new decl. 2016-03-22 Patrick Palka PR c++/70204 * constexpr.c (non_const_var_error): Check DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. 2016-03-21 Richard Henderson PR c++/70273 * decl.c (notice_forced_label_r): New. (cp_finish_decl): Use it. 2016-03-21 Jason Merrill PR c++/70285 * cp-gimplify.c (cp_fold) [COND_EXPR]: Handle bit-fields. 2016-03-18 Jason Merrill PR c++/70139 * constexpr.c (cxx_eval_call_expression): Fix trivial copy. PR c++/70147 * class.c (vptr_via_virtual_p): New. (most_primary_binfo): Factor out of build_rtti_vtbl_entries. * cp-ubsan.c (cp_ubsan_dfs_initialize_vtbl_ptrs): Don't clear a vptr from any virtual base in a not-in-charge 'structor. * decl.c (build_clobber_this): Factor out of start_preparsed_function and begin_destructor_body. Handle virtual bases better. * class.c (build_if_in_charge): Split out from build_base_path. * init.c (expand_virtual_init, expand_default_init): Use it. * call.c (build_special_member_call): Use it. 2016-03-18 Jakub Jelinek PR c++/70267 * init.c (build_new_1): Complain and return error_mark_node if alloc_fn is not _Jv_AllocObject function returning pointer. 2016-03-18 Patrick Palka PR c++/70205 * search.c (adjust_result_of_qualified_name_lookup): Don't update the BASELINK_BINFO of DECL if the second call to lookup_base fails. 2016-03-18 Patrick Palka PR c++/70218 * parser.c (cp_parser_lambda_expression): Move call to pop_deferring_access_checks ahead of the call to cp_parser_end_tentative_firewall. 2016-03-17 Jakub Jelinek PR c++/70144 * cp-tree.h (magic_varargs_p): Return int instead of bool. * call.c (magic_varargs_p): Return int instead of bool, return 2 for Cilk+ reductions, otherwise 1 for magic varargs and 0 for normal varargs. (build_over_call): If magic_varargs_p == 2, call reject_gcc_builtin, if magic_varargs_p == 1, call decay_conversion instead of mark_type_use. Don't store error_mark_node arguments to argarray, instead return error_mark_node. PR c++/70272 * decl.c (begin_destructor_body): Don't insert clobber if is_empty_class (current_class_type). 2016-03-17 Marek Polacek PR c++/70194 * typeck.c (warn_for_null_address): New function. (cp_build_binary_op): Call it. 2016-03-16 Jason Merrill PR c++/70259 * decl.c (start_preparsed_function): Don't clobber an empty base. 2016-03-16 Jakub Jelinek PR c++/70147 * cp-ubsan.c (cp_ubsan_dfs_initialize_vtbl_ptrs): Conditionalize BINFO_VIRTUAL_P vtable clearing on current_in_charge_parm. PR c++/70147 * cp-ubsan.c (cp_ubsan_maybe_initialize_vtbl_ptrs): Temporarily set in_base_initializer. 2016-03-15 Marek Polacek PR c++/70209 * tree.c (strip_typedefs): Call strip_typedefs again on the DECL_ORIGINAL_TYPE result. 2016-03-15 Jason Merrill PR c++/70095 * pt.c (instantiate_decl): Fix call to variable_template_p. PR c++/70141 * pt.c (for_each_template_parm_r): Always walk into TYPENAME_TYPE. 2016-03-14 Casey Carter Jason Merrill P0184R0: Generalizing the Range-Based For Loop * parser.c (cp_convert_range_for): Set the type of __end separately. (cp_parser_perform_range_for_lookup): Allow different begin/end types if they are comparable. 2016-03-12 Patrick Palka PR c++/70106 * semantics.c (force_paren_expr): Just build a PAREN_EXPR when processing_template_decl and EXPR is a SCOPE_REF. 2016-03-10 Patrick Palka Jakub Jelinek PR c++/70001 * constexpr.c (cxx_eval_vec_init_1): For pre_init case, reuse return value from cxx_eval_constant_expression from earlier elements if it is valid constant initializer requiring no relocations. 2016-03-10 Marek Polacek PR c++/70153 * cp-gimplify.c (cp_fold): Handle UNARY_PLUS_EXPR. 2016-03-09 Cesar Philippidis * parser.c (cp_parser_oacc_loop): Update cclauses and clauses when calling c_finish_omp_clauses. 2016-03-08 Jason Merrill * parser.c (cp_parser_diagnose_invalid_type_name): Give helpful diagnostic for use of "concept". (cp_parser_requires_clause_opt): And "requires". (cp_parser_type_parameter, cp_parser_late_return_type_opt) (cp_parser_explicit_template_declaration): Adjust. * Make-lang.in (check-c++-all): Add "concepts" to std list. P0036R0: Unary Folds and Empty Parameter Packs * pt.c (expand_empty_fold): Remove special cases for *,+,&,|. 2016-03-08 Jakub Jelinek PR c++/70135 * constexpr.c (cxx_eval_loop_expr): Forget saved values of SAVE_EXPRs even after the last iteration of the loop. * decl.c (duplicate_decls): Fix spelling - becuase -> because. 2016-03-07 Patrick Palka PR c++/66786 * pt.c (get_template_info): Handle PARM_DECL. (template_class_depth): Check DECL_P instead of VAR_OR_FUNCTION_DECL_P. 2016-03-05 Jason Merrill PR c++/67364 * constexpr.c (cxx_eval_store_expression): Replace CONSTRUCTOR_ELTS in nested CONSTRUCTORs, too. 2016-03-05 Patrick Palka PR c++/66786 * pt.c (template_class_depth): Given a lambda type, iterate into its LAMBDA_TYPE_EXTRA_SCOPE field instead of its TYPE_CONTEXT. Given a VAR_DECL, iterate into its CP_DECL_CONTEXT. 2016-03-04 Jason Merrill PR c++/69203 * cp-tree.h (COND_EXPR_IS_VEC_DELETE): New. * init.c (build_vec_delete_1): Set it. * constexpr.c (potential_constant_expression_1) [COND_EXPR]: Check it. 2016-03-04 Jakub Jelinek * decl.c (start_preparsed_function): Don't emit start clobber at the start of constructor clones. PR c++/70035 * cp-tree.h (cp_ubsan_maybe_initialize_vtbl_ptrs): New prototype. * decl.c (start_preparsed_function): Call cp_ubsan_maybe_initialize_vtbl_ptrs if needed. * cp-ubsan.c (cp_ubsan_dfs_initialize_vtbl_ptrs, cp_ubsan_maybe_initialize_vtbl_ptrs): New functions. 2016-03-04 Jason Merrill PR c++/67364 * constexpr.c (cxx_eval_component_reference): Further tweak. * constexpr.c (struct constexpr_ctx): Add save_exprs field. (cxx_eval_loop_expr): Discard SAVE_EXPR values before looping. (cxx_eval_constant_expression) [SAVE_EXPR]: Add it to the set. (cxx_eval_outermost_constant_expr, is_sub_constant_expr): Initialize. PR c++/70067 * tree.c (strip_typedefs): Handle TYPENAME_TYPE lookup finding the same type. 2016-03-03 Jason Merrill * method.c (synthesized_method_walk): operator= can also be constexpr. * pt.c (tsubst_copy_and_build) [LAMBDA_EXPR]: Get LAMBDA_EXPR_RETURN_TYPE from the instantiated closure. PR c++/67164 * pt.c (copy_template_args): New. (tsubst_pack_expansion): Use it. * call.c (build_aggr_conv): Use get_nsdmi. PR c++/51406 * typeck.c (build_static_cast_1): Avoid folding back to lvalue. PR c++/67364 * constexpr.c (cxx_eval_component_reference): Just return an empty CONSTRUCTOR for an empty class. 2016-03-01 Jason Merrill PR c++/70036 * parser.c (cp_parser_requires_clause): Call check_for_bare_parameter_packs. PR c++/51489 * constexpr.c (cxx_eval_binary_expression): Don't VERIFY_CONSTANT the operands. PR c++/69995 * constexpr.c (cxx_eval_call_expression): Unshare arg. (cxx_eval_constant_expression) [DECL_EXPR]: Unshare init. [TARGET_EXPR]: Unshare init. 2016-03-01 Patrick Palka PR c++/68948 PR c++/69961 * pt.c (tsubst_baselink): Reinstate the check for an invalid constructor call. 2016-02-28 Jason Merrill PR c++/69995 * constexpr.c (cxx_eval_store_expression): Unshare init. 2016-02-26 Jason Merrill PR c++/69958 * pt.c (make_argument_pack): New. (tsubst_copy) [SIZEOF_EXPR]: Handle partial expansion. (tsubst_copy_and_build): Likewise. 2016-02-25 Jason Merrill PR c++/69889 * cp-tree.h (AGGR_INIT_FROM_THUNK_P): New. * tree.c (build_aggr_init_expr): Set it. * semantics.c (simplify_aggr_init_expr): Check it. * cp-gimplify.c (cp_genericize_r): Don't walk into a call/aggr_init from a thunk. PR c++/69842 * method.c (forward_parm): Handle parameter packs. * lambda.c (maybe_add_lambda_conv_op): Use it for them. PR c++/67364 * constexpr.c (cxx_eval_component_reference): Don't complain about unevaluated empty classes. PR c++/68049 * tree.c (strip_typedefs): Use DECL_ORIGINAL_TYPE. 2016-02-25 Patrick Palka PR c++/69736 * cp-tree.h (REF_PARENTHESIZED_P): Adjust documentation. (maybe_undo_parenthesized_ref): Declare. * semantics.c (maybe_undo_parenthesized_ref): Split out from check_return_expr. (finish_call_expr): Use it. * typeck.c (check_return_expr): Use it. * pt.c (tsubst_copy_and_build) [INDIRECT_REF]: Retain the REF_PARENTHESIZED_P flag. 2016-02-24 Jakub Jelinek PR c++/69922 * class.c (build_base_path): Set TREE_NO_WARNING on the null_test. Avoid folding it. * init.c (build_vec_delete_1, build_delete): Don't fold the non-NULL tests. * cp-gimplify.c (cp_fold): For TREE_NO_WARNING comparisons with NULL, unless they are folded into INTEGER_CST, error_mark_node or some comparison with NULL, avoid folding them and use either the original comparison or non-folded comparison of folded arguments. * cp-ubsan.c (cp_ubsan_instrument_vptr): Set TREE_NO_WARNING on the comparison, don't fold the comparison right away. 2016-02-24 Jason Merrill PR c++/69323 * friend.c (make_friend_class): Likewise. * decl.c (lookup_and_check_tag): Diagnose invalid dependent friend. 2016-02-24 Jason Merrill PR c++/69323 * pt.c (instantiate_class_template_1): Set processing_template_decl before substituting friend_type. 016-02-24 Martin Sebor PR c++/69912 * tree.c (build_ctor_subob_ref): Compare types' main variants instead of the types as they are. 2016-02-24 Jason Merrill * decl.c (start_preparsed_function): Condition ctor clobber on flag_lifetime_dse > 1. * cp-gimplify.c (cp_fold): Don't fold constexpr calls if -fno-inline. 2016-02-19 Jason Merrill PR c++/69743 * call.c (remaining_arguments): No longer static. * cp-tree.h: Declare it. * pt.c (more_specialized_fn): Use it. 2016-02-19 Jakub Jelinek Bernd Edlinger * Make-lang.in: Invoke gperf with -L C++. * cfns.gperf: Remove prototypes for hash and libc_name_p inlines. * cfns.h: Regenerated. * except.c (nothrow_libfn_p): Adjust. 2016-02-19 Jakub Jelinek PR c++/69850 * rtti.c (ifnonnull): Set TREE_NO_WARNING on the condition, use NE_EXPR instead of EQ_EXPR and swap last two arguments on COND_EXPR. 2016-02-19 Patrick Palka PR c++/68948 * pt.c (tsubst_baselink): Don't diagnose an invalid constructor call here. * semantics.c (finish_call_expr): Don't assume a constructor call is dependent if only the "this" pointer is dependent. When building a constructor call, always use a dummy object. 2016-02-19 Jakub Jelinek PR c++/69850 * init.c (build_vec_delete_1): Set TREE_NO_WARNING on the NE_EXPR condition. * cp-gimplify.c (cp_fold): Propagate TREE_NO_WARNING from binary operators if folding preserved the binop, just with different arguments. PR c++/67767 * parser.c (cp_parser_std_attribute_spec_seq): Don't assume attr_spec is always single element chain, chain all the attributes properly together in the right order. 2016-02-18 Jason Merrill * mangle.c (maybe_check_abi_tags): Add for_decl parm. Call mangle_decl. (mangle_decl): Call maybe_check_abi_tags for function scope. (mangle_guard_variable): Call maybe_check_abi_tags here. (write_guarded_var_name): Not here. 2016-02-17 Jason Merrill PR c++/65985 * constexpr.c (build_constexpr_constructor_member_initializers): Handle an additional STATEMENT_LIST. PR c++/68585 * constexpr.c (cxx_eval_bare_aggregate): Fix 'changed' detection. PR c++/68679 * decl2.c (reset_type_linkage_2): Look through member templates. 2016-02-17 Jakub Jelinek PR c++/69850 * init.c (build_delete): Set TREE_NO_WARNING on ifexp. 2016-02-17 Jason Merrill PR c++/69842 * method.c (forward_parm): Split out from... (add_one_base_init): ...here. * lambda.c (maybe_add_lambda_conv_op): Use it. 2016-02-16 Jason Merrill PR c++/10200 PR c++/69753 * call.c, cp-tree.h, name-lookup.c, pt.c, search.c, semantics.c, tree.c, typeck2.c: Revert earlier changes. * parser.c (cp_parser_lookup_name): Ignore namespace-scope non-type templates after -> or . 2016-02-16 Jakub Jelinek PR c/69835 * typeck.c (cp_build_binary_op): Revert 2015-09-09 change. 2016-02-16 Jason Merrill PR c++/69657 * name-lookup.c (lookup_qualified_name): Add find_hidden parm. (set_decl_namespace): Pass it. Complain about finding a hidden friend. * name-lookup.h: Adjust. 2016-02-16 James Norris * parser.c (cp_parser_oacc_data_clause_deviceptr): Remove checking. * semantics.c (finish_omp_clauses): Add deviceptr checking. 2016-02-15 Jakub Jelinek PR c++/69658 * init.c (expand_default_init): Only call reshape_init in the direct-initialization from an initializer list case. 2016-02-15 Jason Merrill PR c++/69753 * semantics.c (finish_call_expr): Implicit 'this' does not make the call dependent. * search.c (any_dependent_bases_p): Split out... * name-lookup.c (do_class_using_decl): ...from here. * call.c (build_new_method_call_1): Don't complain about missing object if there are dependent bases. Tweak error. * tree.c (non_static_member_function_p): Remove. * pt.c (type_dependent_expression_p): A member template of a dependent type is dependent. * cp-tree.h: Adjust. PR c++/68890 * constexpr.c (verify_ctor_sanity): Remove CONSTRUCTOR_NELTS check. 2016-02-12 Patrick Palka PR c++/69098 * pt.c (lookup_and_finish_template_variable): New function, extracted from ... (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: ... here. Use it. (tsubst_qualified_id): Consider that EXPR might be a variable template. * typeck.c (check_template_keyword): Don't emit an error if DECL is a variable template. 2016-02-12 Jakub Jelinek * error.c: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * decl.c: Likewise. * typeck.c (cp_build_binary_op): Fix up behavior spelling in diagnostics. * init.c (build_delete): Likewise. 2016-02-11 Jakub Jelinek PR c/69768 * typeck.c (cp_build_binary_op): cp_fully_fold integer_zerop arguments for -Waddress warning. Fix up formatting. 2016-02-11 Paolo Carlini PR c++/68726 * pt.c (lookup_template_class_1): Check tsubst return value for error_mark_node. 2016-02-10 Jason Merrill PR c++/68926 * pt.c (resolve_nondeduced_context): Add complain parm. (do_auto_deduction): Pass it. * cvt.c (convert_to_void): Likewise. * decl.c (cp_finish_decl): Likewise. * init.c (build_new): Likewise. * rtti.c (get_tinfo_decl_dynamic): Likewise. * semantics.c (finish_decltype_type): Likewise. * typeck.c (decay_conversion): Likewise. * cp-tree.h: Adjust declaration. * call.c (standard_conversion): Add complain parm, pass it along. (implicit_conversion): Pass it. PR c++/69657 * name-lookup.c (ambiguous_decl): Call remove_hidden_names. (lookup_name_real_1): Likewise. (remove_hidden_names): Handle non-functions too. PR c++/10200 * parser.c (cp_parser_lookup_name): When looking for a template after . or ->, only consider class templates. (cp_parser_postfix_dot_deref_expression): Handle the current instantiation. Remember a dependent object expression. * typeck2.c (build_x_arrow): Handle the current instantiation. * ptree.c (debug_tree): Implement for cp_expr. 2016-02-08 Patrick Palka PR c++/69139 * parser.c (cp_parser_simple_type_specifier): Make the check for disambiguating between an 'auto' placeholder and an implicit template parameter more robust. 2016-02-08 Patrick Palka PR c++/69283 PR c++/67835 * decl2.c (mark_used): When given a TEMPLATE_DECL, return after setting its TREE_USED flag. 2016-02-08 Jason Merrill PR c++/69657 * name-lookup.c (do_nonmember_using_decl): Leave anticipated built-ins alone. 2016-02-08 Jakub Jelinek PR c++/59627 * parser.c (cp_parser_omp_declare_reduction): Set assembler name of the DECL_OMP_DECLARE_REDUCTION_P decls. 2016-02-08 Marek Polacek PR c++/69688 * constexpr.c (clear_cv_and_fold_caches): Renamed from clear_cv_cache. Call clear_fold_cache. * cp-tree.h: Adjust declaration. * decl.c (finish_enum_value_list): Call clear_cv_and_fold_caches rather than clear_cv_cache and clear_fold_cache. * typeck2.c (store_init_value): Call clear_cv_and_fold_caches. 2016-02-08 Jason Merrill * cp-tree.h (CONV_FOLD, CONV_BACKEND_CONVERT): New. * cvt.c (convert): Pass CONV_BACKEND_CONVERT. (ocp_convert): Use *_maybe_fold. (cp_convert_to_pointer): Add dofold parameter. * cp-gimplify.c (cp_fold) [CONVERT_EXPR]: Call convert. 2016-02-05 Martin Sebor PR c++/69662 * init.c (find_field_init): New function. (warn_placement_new_too_small): Call it. Handle one-element arrays at ends of structures special. 2016-02-05 Jason Merrill PR c++/68948 * semantics.c (finish_expr_stmt): If expr is error_mark_node, make sure we've seen_error(). 2016-02-05 Patrick Palka PR c++/68948 * pt.c (tsubst_baselink): Diagnose an invalid constructor call if lookup_fnfields returns NULL_TREE and the name being looked up has the form A::A. 2016-02-04 Patrick Palka * constexpr.c (cxx_eval_binary_expression): Fold equality comparisons involving PTRMEM_CSTs. 2016-02-04 Jakub Jelinek * class.c (find_flexarrays): Don't declare dom variable. (diagnose_flexarray): Likewise. 2016-02-02 Martain Sebor PR c++/69251 PR c++/69253 PR c++/69290 PR c++/69277 PR c++/69349 * class.c (walk_subobject_offsets): Avoid testing the upper bound of a flexible array member for equality to null. (find_flexarrays): Remove spurious whitespace introduced in r231665. (diagnose_flexarrays): Avoid checking the upper bound of arrays. (check_flexarrays): Same. * decl.c (compute_array_index_type): Avoid special case for flexible array members. (grokdeclarator): Avoid calling compute_array_index_type for flexible array members. * error.c (dump_type_suffix): Revert changes introduced in r231665 and rendered unnecessary by the changes above. * pt.c (tsubst): Same. * tree.c (build_ctor_subob_ref): Handle flexible array members. * typeck2.c (digest_init_r): Revert changes introduced in r231665. (process_init_constructor_array): Same. (process_init_constructor_record): Same. 2016-02-03 Patrick Palka PR c++/69056 * pt.c (try_one_overload): Handle comparing argument packs so that there is no conflict if we deduced more arguments of an argument pack than were explicitly specified. 2016-01-31 Jakub Jelinek Jason Merrill PR c++/68763 * tree.c (strip_typedefs) [FUNCTION_TYPE]: Avoid building a new function type if nothing is changing. 2016-01-31 Jason Merrill PR c++/69009 * pt.c (partial_specialization_p, impartial_args): New. (instantiate_decl): Call impartial_args. * mangle.c (maybe_check_abi_tags): New. (write_guarded_var_name): Call it. (mangle_ref_init_variable): Call check_abi_tags. * pt.c (lookup_template_class_1): Don't share TYPE_ATTRIBUTES between template and instantiation. 2016-01-29 Jakub Jelinek PR debug/66869 * decl.c (wrapup_globals_for_namespace): Warn about unused static function declarations. 2016-01-29 Marek Polacek PR c++/69509 PR c++/69516 * constexpr.c (cxx_eval_array_reference): Give the "array subscript out of bound" error earlier. * init.c (build_vec_init): Change NE_EXPR into GT_EXPR. Update the commentary. 2016-01-29 Patrick Palka * name-lookup.c (begin_scope): After reusing a cp_binding_level structure, update free_binding_level before the structure's level_chain field gets cleared, not after. 2016-01-28 Jason Merrill PR c++/67407 * search.c (dfs_walk_once, dfs_walk_once_r) (dfs_walk_once_accessible_r, dfs_walk_once_accessible): Use hash_set instead of BINFO_MARKED. (dfs_unmark_r): Remove. 2016-01-28 Patrick Palka PR c++/24208 * parser.c (LEXER_DEBUGGING_ENABLED_P): New macro. (cp_lexer_debugging_p): Use it. (cp_lexer_start_debugging): Likewise. (cp_lexer_stop_debugging): Likewise. 2016-01-27 Marek Polacek PR c/68062 * typeck.c (cp_build_binary_op): Promote operand to unsigned, if needed. Add -Wsign-compare warning. 2016-01-27 Ryan Burn PR cilkplus/69267 * cp-gimplify.c (cilk_cp_gimplify_call_params_in_spawned_fn): Removed superfluous post_p argument in call to cilk_gimplify_call_params_in_spawned_fn. 2016-01-27 Marek Polacek PR c++/69379 * constexpr.c (cxx_eval_constant_expression): Handle PTRMEM_CSTs wrapped in NOP_EXPRs. 2016-01-27 Martin Sebor PR c++/69317 * mangle.c (mangle_decl): Reference the correct (saved) version of the ABI in -Wabi diagnostics. 2016-01-27 Marek Polacek PR c++/69496 * constexpr.c (cxx_eval_array_reference): Evaluate the number of elements of the array. 2016-01-26 Jason Merrill PR c++/68949 * constexpr.c (register_constexpr_fundef): Keep the un-massaged body. (cxx_eval_call_expression): Don't look through clones. * optimize.c (maybe_clone_body): Clear DECL_SAVED_TREE of the alias. * semantics.c (expand_or_defer_fn_1): Keep DECL_SAVED_TREE of maybe-in-charge *tor. 2016-01-26 Jason Merrill PR c++/68782 * constexpr.c (cxx_eval_bare_aggregate): Update TREE_CONSTANT and TREE_SIDE_EFFECTS. (cxx_eval_constant_expression) [CONSTRUCTOR]: Call verify_constructor_flags. 2016-01-26 Jakub Jelinek PR c++/68357 * cp-gimplify.c (cp_fold): If some operand folds to error_mark_node, return error_mark_node instead of building trees with error_mark_node operands. 2016-01-26 David Malcolm PR other/69006 * error.c (print_instantiation_partial_context_line): Add missing newlines from output for the t == NULL case. (print_instantiation_partial_context): Remove call to pp_newline. 2016-01-24 Patrick Palka Revert: 2016-01-18 Patrick Palka PR c++/11858 PR c++/24663 PR c++/24664 * decl.c (grokdeclarator): Don't decay array parameter type to a pointer type if it's dependent. (grokparms): Invoke strip_top_quals instead of directly invoking cp_build_qualified_type. * pt.c (decay_dependent_array_parm_type): New static function. (type_unification_real): Call decay_dependent_array_parm_type to decay a dependent array parameter type to its corresponding pointer type before unification. (more_specialized_fn): Likewise. (get_bindings): Likewise. * tree.c (cp_build_qualified_type): Trivial typofix in documentation. 2016-01-23 Martin Sebor PR c++/58109 PR c++/69022 * decl2.c (is_late_template_attribute): Handle dependent argument to attribute align and attribute vector_size. 2016-01-21 Jason Merrill PR c++/69392 * lambda.c (lambda_capture_field_type): Handle 'this' specially for init-capture, too. PR c++/65687 * decl.c (type_is_deprecated): Don't look into a typedef. PR c++/40751 PR c++/64987 * decl.c (copy_type_enum): Respect TYPE_USER_ALIGN. PR c++/43407 * decl.c (start_enum): Add attributes parameter. * parser.c (cp_parser_enum_specifier): Pass it. * pt.c (lookup_template_class_1): Pass it. * cp-tree.h: Adjust. 2016-01-19 Jason Merrill PR c++/59759 * pt.c (convert_template_argument): Handle VAR_DECL properly. 2016-01-19 Marek Polacek PR c++/68586 * constexpr.c (clear_cv_cache): New. * cp-gimplify.c (clear_fold_cache): New. * cp-tree.h (clear_cv_cache, clear_fold_cache): Declare. * decl.c (finish_enum_value_list): Call them. PR c++/68965 * pt.c (tsubst_copy): Mark elements in expanded vector as used. 2016-01-18 Patrick Palka PR c++/11858 PR c++/24663 PR c++/24664 * decl.c (grokdeclarator): Don't decay array parameter type to a pointer type if it's dependent. (grokparms): Invoke strip_top_quals instead of directly invoking cp_build_qualified_type. * pt.c (decay_dependent_array_parm_type): New static function. (type_unification_real): Call decay_dependent_array_parm_type to decay a dependent array parameter type to its corresponding pointer type before unification. (more_specialized_fn): Likewise. (get_bindings): Likewise. * tree.c (cp_build_qualified_type): Trivial typofix in documentation. 2016-01-18 Jason Merrill * cp-gimplify.c (cp_fold) [CONSTRUCTOR]: Don't clobber the input. * cp-gimplify.c (cp_fold): Remove unnecessary special cases. PR c++/68767 * cp-gimplify.c (cp_fold) [COND_EXPR]: Simplify. Do fold COND_EXPR. (contains_label_1, contains_label_p): Remove. 2016-01-16 Patrick Palka PR c++/69091 * pt.c (type_dependent_expression_p): For a function template specialization, a type is dependent iff any of its template arguments are. 2016-01-16 Patrick Palka * cp-array-notation.c (cp_expand_cond_array_notations): Return error_mark_node only if find_rank failed, not if it was successful. 2016-01-16 Patrick Palka PR c++/68936 * tree.c (build_min_non_dep_call_vec): Don't retain the KOENIG_LOOKUP_P flag of the non-dependent expression that's been built. (build_min_non_dep_op_overload): Instead, do it here. 2016-01-15 Jakub Jelinek PR bootstrap/68271 * parser.h (cp_token): Remove pragma_kind field. Add comment with number of unused bits. * parser.c (eof_token): Remove pragma_kind field initializer. (cp_lexer_get_preprocessor_token): Don't set pragma_kind field, don't clear CPP_PRAGMA u.value. (cp_parser_pragma_kind): New function. (cp_parser_omp_sections_scope, cp_parser_oacc_kernels_parallel, cp_parser_omp_construct, cp_parser_initial_pragma, cp_parser_pragma): Use cp_parser_pragma_kind instead of accessing pragma_kind field. 2016-01-15 Jason Merrill PR c++/68847 * call.c (build_cxx_call): Use fold_non_dependent_expr. * typeck2.c (cxx_incomplete_type_diagnostic): Use the location of value. PR c++/69257 * typeck.c (decay_conversion): Don't call mark_rvalue_use for array/function-to-pointer conversion. Call complete_type_or_maybe_complain for lvalue-to-rvalue conversion. * call.c (convert_like_real): Print call context if decay_conversion errors. 2016-01-14 Tom de Vries PR tree-optimization/68773 * parser.c (cp_parser_oacc_declare, cp_parser_omp_declare_target): Don't set force_output. 2016-01-14 Jason Merrill PR c++/69261 * constexpr.c (find_array_ctor_elt): Handle splitting RANGE_EXPR. 2016-01-12 Marek Polacek PR c++/68979 * constexpr.c (cxx_eval_check_shift_p): Use permerror rather than error_at and adjust the return value. 2016-01-12 Jakub Jelinek PR objc++/68511 PR c++/69213 * cp-gimplify.c (cp_gimplify_expr) : Don't return GS_ERROR whenever seen_error (), only if *expr_p contains cilk spawn stmt, but cilk_detect_spawn_and_unwrap failed. PR c++/66808 PR c++/69000 * pt.c (tsubst_decl): If not local_p, clear DECL_TEMPLATE_INFO. 2016-01-11 Jason Merrill PR c++/69131 * method.c (walk_field_subobs): Add dtor_from_ctor parm. (process_subob_fn): Likewise. Don't consider triviality if true. (synthesize_method_walk): Pass it. 2016-01-11 David Malcolm PR c++/68795 * parser.c (cp_parser_postfix_expression): Initialize close_paren_loc to UNKNOWN_LOCATION; only use it if it has been written to by cp_parser_parenthesized_expression_list. (cp_parser_parenthesized_expression_list): Document the behavior with respect to the CLOSE_PAREN_LOC param. 2016-01-11 Jakub Jelinek PR c++/69211 * cp-gimplify.c (cp_fold): If COMPOUND_EXPR or MODIFY_EXPR folded operands have side-effects, but folding changed any of them, build a new tree with the folded operands instead of returning the unfolded tree. 2016-01-09 Marek Polacek PR c++/69113 * decl2.c (comdat_linkage): Only set DECL_COMDAT if TREE_PUBLIC is set. 2016-01-09 Jakub Jelinek PR c++/69164 * class.c (layout_class_type): Use copy_node to copy FIELD_DECLs. 2016-01-08 Jason Merrill PR c++/69158 * constexpr.c (cxx_fold_indirect_ref): Handle array type differing in completion. 2016-01-08 Marek Polacek PR c++/68449 * constexpr.c (cxx_eval_constant_expression): Handle NULL initializer. 2016-01-08 Jason Merrill * constexpr.c (cxx_eval_call_expression): Remove convert_to_void workaround. PR c++/68983 PR c++/67557 * cvt.c (convert_to_void): Don't strip a TARGET_EXPR of TREE_ADDRESSABLE type. PR c++/68983 PR c++/67557 * call.c (unsafe_copy_elision_p): Look through COMPOUND_EXPR. 2016-01-05 Nathan Sidwell PR c++/58583 * pt.c (build_non_dependent_expr): Don't try a checking fold when parsing an nsdmi. 2016-01-04 Jakub Jelinek Update copyright years. Copyright (C) 2016 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.