aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/method.c
AgeCommit message (Collapse)AuthorFilesLines
2017-10-06re PR c++/47791 (finish function is using literal value instead of a ↵Paolo Carlini1-1/+1
#defined one) 2017-10-06 Paolo Carlini <paolo.carlini@oracle> PR c++/47791 * decl.c (finish_function): Take a bool intead of an int; adjust. * cp-tree.h (finish_function): Adjust declaration. * decl2.c (generate_tls_wrapper, finish_objects, finish_static_storage_duration_function): Adjust calls. * lambda.c (maybe_add_lambda_conv_op, finish_lambda_function): Likewise. * method.c (synthesize_method): Likewise. * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise. * pt.c (instantiate_decl): Likewise. * parser.c (cp_parser_function_definition_after_declarator, cp_parser_late_parsing_for_member, cp_parser_omp_declare_reduction): Likewise. (cp_parser_ctor_initializer_opt, cp_parser_ctor_initializer_opt_and_function_body, cp_parser_function_try_block, cp_parser_function_definition_after_declarator, cp_parser_function_transaction): Return void; adjust declarations. From-SVN: r253497
2017-09-30re PR c++/68754 (Explicitly defaulted constexpr assignment operator fails to ↵Paolo Carlini1-3/+5
compile) /cp 2017-09-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/68754 * method.c (defaulted_late_check): Early return if the defaulted declaration does not match the expected signature. /testsuite 2017-09-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/68754 * g++.dg/cpp1y/constexpr-68754.C: Move... * g++.dg/cpp0x/constexpr-68754.C: ... here, adjust. From-SVN: r253321
2017-09-06name-lookup.h (lookup_fnfields_slot_nolazy, [...]): Rename to ...Nathan Sidwell1-1/+1
* name-lookup.h (lookup_fnfields_slot_nolazy, lookup_fnfields_slot): Rename to ... (get_class_binding_direct, get_class_binding): ... here. * name-lookup.c (lookup_fnfields_slot_nolazy, lookup_fnfields_slot): Rename to ... (get_class_binding_direct, get_class_binding): ... here. * cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Adjust. * call.c (build_user_type_conversion_1): Adjust. (has_trivial_copy_assign_p): Adjust. (has_trivial_copy_p): Adjust. * class.c (get_basefndecls) Adjust. (vbase_has_user_provided_move_assign) Adjust. (classtype_has_move_assign_or_move_ctor_p): Adjust. (type_build_ctor_call, type_build_dtor_call): Adjust. * decl.c (register_dtor_fn): Adjust. * decl2.c (check_classfn): Adjust. * pt.c (retrieve_specialization): Adjust. (check_explicit_specialization): Adjust. (do_class_deduction): Adjust. * search.c (lookup_field_r): Adjust. (look_for_overrides_here, lookup_conversions_r): Adjust. * semantics.c (classtype_has_nothrow_assign_or_copy_p): Adjust. * tree.c (type_has_nontrivial_copy_init): Adjust. * method.c (lazily_declare_fn): Adjust comment. From-SVN: r251780
2017-08-29Fix lambdas in template default argument of inherited ctor.Jason Merrill1-15/+27
* 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. From-SVN: r251426
2017-08-10PR c++/81359 - Unparsed NSDMI error from SFINAE context.Jason Merrill1-4/+10
* method.c (synthesized_method_walk): Don't diagnose lack of operator delete. From-SVN: r251036
2017-08-09PR c++/81359 - Unparsed NSDMI error from SFINAE context.Jason Merrill1-6/+14
* init.c (get_nsdmi): Add complain parm. * typeck2.c (digest_nsdmi_init): Add complain parm. (process_init_constructor_record): Pass complain to get_nsdmi. * pt.c (maybe_instantiate_noexcept): Add complain parm, return bool. * method.c (get_defaulted_eh_spec): Add complain parm. Pass it into synthesized_method_walk. (synthesized_method_walk): Adjust. (walk_field_subobs): Pass complain to get_nsdmi. (defaulted_late_check): Skip other checks if deleted. * decl2.c (mark_used): Pass complain to maybe_instantiate_noexcept. * call.c (build_aggr_conv): Pass complain to get_nsdmi. * parser.c (defarg_location): New. * error.c (location_of): Use it. From-SVN: r250994
2017-07-26PR c++/67054 - Inherited ctor with non-default-constructible membersLeonid Koppel1-1/+1
PR c++/67054 - Inherited ctor with non-default-constructible members * method.c (walk_field_subobs) Consider member initializers (NSDMIs) when deducing an inheriting constructor. From-SVN: r250583
2017-07-21Remove TYPE_METHODS.Nathan Sidwell1-6/+13
gcc/ Remove TYPE_METHODS. * tree.h (TYPE_METHODS): Delete. * dwarf2out.c (gen_member_die): Member fns are on TYPE_FIELDS. * dbxout.c (dbxout_type_fields): Ignore FUNCTION_DECLs. (dbxout_type_methods): Scan TYPE_FIELDS. (dbxout_type): Don't check TYPE_METHODS here. * function.c (use_register_for_decl): Always ignore register for class types when not optimizing. * ipa-devirt.c (odr_types_equivalent_p): Delete TYPE_METHODS scan. * tree.c (free_lang_data_in_type): Stitch out member functions and templates from TYPE_FIELDS. (build_distinct_type_copy, verify_type_variant, verify_type): Member fns are on TYPE_FIELDS. * tree-dump.c (dequeue_and_dump): No TYPE_METHODS. * tree-pretty-print.c (dump_generic_node): Likewise. gcc/cp/ Remove TYPE_METHODS. * class.c (maybe_warn_about_overly_private_class, finish_struct_methods, one_inheriting_sig, count_fields, add_fields_to_record_type, check_field_decls, check_methods, clone_function_decl, set_method_tm_attributes, finalize_literal_type_property, check_bases_and_members, create_vtable_ptr, determine_key_method, unreverse_member_declarations, finish_struct, add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS. * decl.c (fixup_anonymous_aggr): Likewise. * decl2.c (reset_type_linkage_2): Likewise. * method.c (after_nsdmi_defaulted_late_checks, lazily_declare_fn): Likewise. * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise. * pt.c (instantiate_class_template_1, tsubst_expr, do_type_instantiation, instantiate_pending_templates): Likewise. * search.c (lookup_field_1): Likewise. * semantics.c (finish_member_declaration, finish_omp_declare_simd_methods): Likewise. gcc/c-family/ Remove TYPE_METHODS. * c-ada-spec.c (is_tagged_type, has_nontrivial_methods, dump_ada_template, print_ada_methods, print_ada_declaration): Member fns are on TYPE_FIELDS. gcc/objc/ Remove TYPE_METHODS. * objc-runtime-shared-support.c (build_ivar_list_initializer): Don't presume first item is a FIELD_DECL. gcc/testsuite/ * g++.dg/ext/anon-struct6.C: Adjust diag. * g++.old-deja/g++.other/anon4.C: Adjust diag. libcc1/ Remove TYPE_METHODS. * libcp1plugin.cc (plugin_build_decl): Member fns are on TYPE_FIELDS. From-SVN: r250413
2017-07-19class.c (add_implicitly_declared_members): Use ↵Nathan Sidwell1-3/+3
classtype_has_move_assign_or_move_ctor_p. * class.c (add_implicitly_declared_members): Use classtype_has_move_assign_or_move_ctor_p. (classtype_has_move_assign_or_move_ctor, classtype_has_user_move_assign_or_move_ctor_p): Merge into ... (classtype_has_move_assign_or_move_ctor_p): ... this new function. * cp-tree.h (classtype_has_user_move_assign_or_move_ctor_p): Replace with ... (classtype_has_move_assign_or_move_ctor_p): ... this. * method.c (maybe_explain_implicit_delete, lazily_declare_fn): Adjust. * tree.c (type_has_nontrivial_copy_init): Adjust. From-SVN: r250344
2017-07-17class.c (type_has_user_declared_move_constructor, [...]): Combine into ...Nathan Sidwell1-8/+4
* class.c (type_has_user_declared_move_constructor, type_has_user_declared_move_assign): Combine into ... (classtype_has_user_move_assign_or_move_ctor_p): ... this new function. * cp-tree.h (type_has_user_declared_move_constructor, type_has_user_declared_move_assign): Combine into ... (classtype_has_user_move_assign_or_move_ctor_p): ... this. Declare. * method.c (maybe_explain_implicit_delete): Use it. (lazily_declare_fn): Use it. * tree.c (type_has_nontrivial_copy_init): Use it. From-SVN: r250280
2017-07-12cp-tree.h (DECL_CONSTRUCTOR_P, [...]): Look at identifier flags.Nathan Sidwell1-6/+6
* cp-tree.h (DECL_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_CONSTRUCTOR, DECL_DESTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRCTOR): Look at identifier flags. * decl.c (grokfndecl): Set DECL_CXX_CONSTRUCTOR and DECL_CXX_DESTRUCTOR explicitly. * decl2.c (grokclassfn): Likewise. * friend.c (do_friend): Likewise. * method.c (make_thunk, make_alias_for, implicitly_declare_fn): Likewise. From-SVN: r250158
2017-06-30call.c (build_new_method_call_1): Use constructo_name to get ctor name.Nathan Sidwell1-9/+10
* call.c (build_new_method_call_1): Use constructo_name to get ctor name. Move argument processing earlier to merge cdtor handling blocks. * decl.c (grokfndecl): Cdtors have special names. * method.c (implicitly_declare_fn): Likewise. Simplify flag setting. * pt.c (check_explicit_specialization): Cdtor name is already special. * search.c (class_method_index_for_fn): Likewise. * g++.dg/plugin/decl-plugin-test.C: Expect special ctor name. From-SVN: r249838
2017-06-29Whitespace cleanups.Nathan Sidwell1-3/+2
* call.c (name_as_c_string): Move CONST_CAST to return. (build_new_method_call_1): Remove unneeded bracing. * class.c (include_empty_classes): Unbreak line. * constraint.cc (tsubst_check_constraint): Add space. * cp-tree.h (lang_decl_ns): Add comment. (PTRMEM_CST_MEMBER): Break line. * decl.c (grokfndecl): Add blank lines. Unbreak some others. (grokdeclarator): Remove lines, move declaration to first use. * decl2.c (decl_needed_p): Fix indentation. (c_parse_final_cleanups): Remove blank line. * method.c (implicitly_declare_fn): Move declaration to first use. * search.c (current_scope): Add blank lines. From-SVN: r249786
2017-06-26cp-tree.h (lang_decl_fn): Remove assignment_operator_p field.Nathan Sidwell1-4/+1
gcc/cp/ * cp-tree.h (lang_decl_fn): Remove assignment_operator_p field. (DECL_COMPLETE_CONSTRUCTOR_P): Directly compare identifier. (DECL_BASE_CONSTRUCTOR_P, DECL_COMPLETE_DESTRUCTOR_P) DECL_BASE_DESTRUCTOR_P, DECL_DELETING_DESTRUCTOR_P): Likewise. (DECL_ASSIGNMENT_OPERATOR_P): Use IDENTIFIER_ASSIGN_OP_P. * decl.c (grok_op_properties): Adjust identifier checking. * init.c (expand_default_init): Adjust identifier descision. * method.c (implicitly_declare_fn): Don't use DECL_ASSIGNMENT_OPERATOR_P. * search.c (lookup_fnfields_1): Use IDENTIFIER_CTOR_P, IDENTIFIER_DTOR_P. * call.c (in_charge_arg_for_name): Reimplement. (build_special_member_call): Use IDENTIFIER_CDTOR_P, IDENTIFIER_DTOR_P. libcc1/ * libcp1plugin.cc (plugin_build_decl): Don't set DECL_ASSIGNMENT_OPERATOR_P. (--This line, and those below, will be ignored-- M gcc/cp/init.c M gcc/cp/decl.c M gcc/cp/method.c M gcc/cp/cp-tree.h M gcc/cp/call.c M gcc/cp/search.c M gcc/cp/ChangeLog M libcc1/ChangeLog M libcc1/libcp1plugin.cc From-SVN: r249657
2017-06-18PR c++/70844 - -Wuseless-cast and inheriting constructor.Jason Merrill1-0/+1
* method.c (forward_parm): Suppress warn_useless_cast. From-SVN: r249344
2017-06-16cp-tree.h (build_this_parm, [...]): Add FN parm.Nathan Sidwell1-4/+3
gcc/cp/ * cp-tree.h (build_this_parm, cp_build_parm_decl) build_artificial_parm): Add FN parm. * decl.c (start_cleanup_fn): Adjust. (build_this_parm): Add FN parm, pass it through. (grokfndecl): Adjust parm building. * decl2.c (cp_build_parm_decl): Add FN parm, set context. (build_artificial_parm): Add FN parm, pass through. (maybe_retrofit_in_chrg): Adjust parm building. (start_static_storage_duration_function): Likwise. * lambda.c (maybe_aadd_lambda_conv_op): Likewise. * method.c (implicitly_declare_fn): Likewise. * parser.c (inject_this_parameter): Likewise. libcc1/ * libcp1plugin.cc (plugin_build_decl): Adjust parm building. (--This line, and those below, will be ignored-- M gcc/cp/parser.c M gcc/cp/ChangeLog M gcc/cp/decl.c M gcc/cp/lambda.c M gcc/cp/cp-tree.h M gcc/cp/method.c M gcc/cp/decl2.c M libcc1/libcp1plugin.cc M libcc1/ChangeLog From-SVN: r249268
2017-06-16Don't defer noexcept_deferred_spec.Nathan Sidwell1-1/+1
* cp-tree.h (unevaluated_noexcept_spec): Don't declare. * decl.c (cxx_init_decl_processing): Initialize noexcept_deferred_spec. * except.c (unevaluated_noexcept_spec): Delete. * class.c (deduce_noexcept_on_destructor): Use noexcept_deferred_spec directly. * method.c (implicitly_declare_fn): Likewise. From-SVN: r249264
2017-06-01re PR c++/80812 (ICE: in build_value_init_noctor, at cp/init.c:483)Ville Voutilainen1-1/+1
PR c++/80812 cp/ PR c++/80812 * method.c (constructible_expr): Strip array types before calling build_value_init. libstdc++/ PR c++/80812 * testsuite/20_util/is_constructible/80812.cc: New. From-SVN: r248788
2017-05-19call.c (add_list_candidates): Use OVL_FIRST.Nathan Sidwell1-1/+2
* call.c (add_list_candidates): Use OVL_FIRST. (build_new_method_call_1): Likewise. * cp-tree.h (OVL_SINGLE_P): New. (TYPE_HIDDEN_P): New. * decl.c (xref_tag_1): Use TYPE_HIDDEN_P. * dump.c (cp_tump_tree): Adjust overload dumping. * error.c (dump_decl): Use OVL_SINGLE_P, simplify context printing. * method.c (lazily_declare_fn): Assert we added it. * parser.c (cp_parser_nested_name_specifier): Use OVL_SINGLE_P, OVL_FIRST. (cp_parser_template_name): Use lkp_iterator. * pt.c (begin_template_parm_list): Fixup comment. (instantiate_class_template_1): Use TYPE_HIDDEN_P. * tree.c (ovl_iterator::remove_node): Cope with inherited ctors. (ovl_scope): Use lkp_iterator. From-SVN: r248285
2017-05-17Implement new C++ intrinsics __is_assignable and __is_constructible.Ville Voutilainen1-7/+35
c-family/ Implement new C++ intrinsics __is_assignable and __is_constructible. * c-common.c (__is_assignable, __is_constructible): New. * c-common.h (RID_IS_ASSIGNABLE, RID_IS_CONSTRUCTIBLE): Likewise. cp/ PR c++/80654 PR c++/80682 Implement new C++ intrinsics __is_assignable and __is_constructible. * cp-tree.h (CPTK_IS_ASSIGNABLE, CPTK_IS_CONSTRUCTIBLE): New. (is_xible): New. * cxx-pretty-print.c (pp_cxx_trait_expression): Handle CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE. * method.c (constructible_expr): Set cp_unevaluated. (is_xible_helper): New. (is_trivially_xible): Adjust. (is_xible): New. * parser.c (cp_parser_primary_expression): Handle RID_IS_ASSIGNABLE and RID_IS_CONSTRUCTIBLE. (cp_parser_trait_expr): Likewise. * semantics.c (trait_expr_value): Handle CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE. testsuite/ * g++.dg/ext/80654.C: New. libstdc++-v3/ Implement new C++ intrinsics __is_assignable and __is_constructible. * include/std/type_traits (__do_is_static_castable_impl): Remove. (__is_static_castable_impl, __is_static_castable_safe): Likewise. (__is_static_castable, __do_is_direct_constructible_impl): Likewise. (__is_direct_constructible_impl): Likewise. (__is_direct_constructible_new_safe): Likewise. (__is_base_to_derived_ref, __is_lvalue_to_rvalue_ref): Likewise. (__is_direct_constructible_ref_cast): Likewise. (__is_direct_constructible_new, __is_direct_constructible): Likewise. (__do_is_nary_constructible_impl): Likewise. (__is_nary_constructible_impl, __is_nary_constructible): Likewise. (__is_constructible_impl): Likewise. (is_constructible): Call the intrinsic. (__is_assignable_helper): Remove. (is_assignable): Call the intrinsic. (is_trivially_constructible): Likewise. (__is_trivially_copy_constructible_impl): New. (is_trivially_copy_constructible): Use it. (__is_trivially_move_constructible_impl): New. (is_trivially_move_constructible): Use it. (is_trivially_assignable): Call the intrinsic. (__is_trivially_copy_assignable_impl): New. (is_trivially_copy_assignable): Use it. (__is_trivially_move_assignable_impl): New. (is_trivially_move_assignable): Use it. (testsuite/20_util/declval/requirements/1_neg.cc): Adjust. (testsuite/20_util/is_trivially_copy_assignable/value.cc): Add test for void. (testsuite/20_util/is_trivially_copy_constructible/value.cc): Likewise. (testsuite/20_util/is_trivially_move_assignable/value.cc): Likewise. (testsuite/20_util/is_trivially_move_constructible/value.cc): Likewise. (testsuite/20_util/make_signed/requirements/typedefs_neg.cc): Adjust. (testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc): Likewise. From-SVN: r248153
2017-05-16cp-tree.h (class ovl_iterator, [...]): New OVERLOAD iterators.Nathan Sidwell1-4/+4
* cp-tree.h (class ovl_iterator, class lkp_iterator): New OVERLOAD iterators. (MAYBE_BASELINK_FUNCTIONS): New. * constraint.cc (resolve_constraint_check): Use lkp_iterator. * decl2.c (maybe_warn_sized_delete): Use ovl_iterator. * lambda.c (maybe_generic_this_capture): Use lkp_iterator. * method.c (inherited_ctor_binfo): Use ovl_iterator. (binfo_inherited_from): Likewise. * parser.c (lookup_literal_operator): Use lkp_iterator. * pt.c (iterative_hash_template_arg): Use lkp_iterator. (print_candidates_1): Likewise. (determine_specialization): Likewise. (resolve_overloaded_unification): Likewise. (resolve_nondeduced_context): Likewise. (type_dependent_expression_p): Likewise. (dependent_template_p): Likewise. * ptree.c (cxx_print_xnode): Likewise. * semantics.c (omp_reduction_lookup): Use lkp_iterator. (classtype_has_nothrow_assign_or_copy_p): Use ovl_iterator. * typeck.c (check_template_keyword): Use lkp_iterator. From-SVN: r248112
2017-05-16cp-tree.h (OVL_FIRST, OVL_NAME): New.Nathan Sidwell1-4/+2
* cp-tree.h (OVL_FIRST, OVL_NAME): New. (ovl_first): New. * constexpr.c (function_concept_check): Use OVL_FIRST. * cvt.c (build_expr_type_conversion): Likewise. * decl.c (poplevel, grokdeclarator): Use OVL_NAME. * decl2.c (mark_used): Use OVL_FIRST. * error.c (dump_decl): Use OVL_FIRST, OVL_NAME. (dump_expr, location_of): Use OVL_FIRST. * friend.c (do_friend): Use OVL_NAME. * init.c (build_offset_ref): Use OVL_FIRST. * mangle.c (write_member_name): Likewise. (write_expression): Use OVL_NAME. * method.c (strip_inheriting_ctors): Use OVL_FIRST. * name-lookup.c (pushdecl_class_level): Use OVL_NAME. * pt.c (check_explicit_specialization): Use OVL_FIRST. (check_template_shadow): Likewise. (tsubst_template_args): Use OVL_NAME. (tsubst_baselink): Use OVL_FIRST. * semantics.c (perform_koenig_lookup): Use OVL_NAME. * tree.c (get_first_fn): Use OVL_FIRST. * typeck.c (finish_class_member_access_expr): Use OVL_NAME. (cp_build_addr_expr_1): Use OVL_FIRST. From-SVN: r248108
2017-05-11cp-tree.h (pushdecl, [...]): Move declarations to ...Nathan Sidwell1-1/+1
* cp-tree.h (pushdecl, pushdecl_maybe_friend, pushtag) pushtag_top_level_maybe_friend, pushdecl_top_level_and_finish): Move declarations to ... * name-lookup.h: ... here. Group pushdecl variants. (pushdecl_top_level_and_finish): Rename to ... (pushdecl_top_level_with_init): ... here. * decl.c (cp_make_fname_decl): Use pushdecl_top_level_with_init. * decl2.c (get_guard, handle_tls_init): Likewise. * rtti.c (get_tinfo_decl, tinfo_base_init): Likewise. * lambda.c (maybe_add_lambda_conv_op): Use namespace_bindings_p. * method.c (implicitly_declare_fn): Likewise. * searchc (node_debug_info_needed): Likewise. * name-lookup.c (pushdecl_top_level_and_finish): Rename to ... (pushdecl_top_level_with_init): ... here. (pop_everything): Use namespace_bindings_p. (--This line, and those below, will be ignored-- M cp/ChangeLog M cp/method.c M cp/cp-tree.h M cp/decl.c M cp/lambda.c M cp/rtti.c M cp/name-lookup.c M cp/decl2.c M cp/name-lookup.h M cp/search.c From-SVN: r247902
2017-05-11re PR c++/80682 (__is_trivially_constructible(void, int) returns true.)Ville Voutilainen1-0/+2
PR c++/80682 cp/ PR c++/80682 * method.c (is_trivially_xible): Reject void types. testsuite/ PR c++/80682 * g++.dg/ext/is_trivially_constructible1.C: Add tests for void target. From-SVN: r247880
2017-05-10cp-tree.h (add_method, [...]): Change last arg to bool.Nathan Sidwell1-2/+2
gcc/cp/ * cp-tree.h (add_method, clone_function_decl): Change last arg to bool. * class.c (add_method): Change third arg to bool. Adjust. (one_inheriting_sig, one_inherited_ctor): Adjust. (clone_function_decl): Change 2nd arg to bool. Adjust. (clone_constructors_and_destructors): Adjust. * lambda.c (maybe_add_lambda_conv_op): Adjust. * method.c (lazily_declare_fn): Adjust. * pt.c (tsubst_decl, instantiate_template_1): Adjust. * semantics.c (finish_member_declaration): Adjust. libcc1/ * libcp1plugin.cc (plugin_build_decl): Adjust add_method call. From-SVN: r247834
2017-03-14PR c++/79393 DR 1658 workaroundNathan Sidwell1-16/+18
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. From-SVN: r246126
2017-03-13PR c++/79393 DR 1658 workaroundNathan Sidwell1-1/+17
PR c++/79393 DR 1658 workaround * method.c (synthesized_method_walk): Check vbases of abstract classes for dtor walk. From-SVN: r246085
2017-03-04Core issues 2273 and 2277Jason Merrill1-1/+2
* 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. From-SVN: r245892
2017-02-15PR c++/79464 - ICE in IPA with omitted constructor parmsJason Merrill1-0/+3
* 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. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r245495
2017-02-07method.c (synthesized_method_base_walk): New.Nathan Sidwell1-112/+99
* method.c (synthesized_method_base_walk): New. Broken out of ... (synthesized_method_walk): ... here. Call it. Cleanup initializations. From-SVN: r245250
2017-01-31Introduce C++ support in libcc1Alexandre Oliva1-5/+5
Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog 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. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-27PR c++/78771 - ICE with inherited constructor.Jason Merrill1-3/+11
* 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. From-SVN: r244988
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994
2016-12-21PR c++/78767 - ICE with inherited constructor default argumentJason Merrill1-1/+5
* method.c (strip_inheriting_ctors): Strip template as appropriate. From-SVN: r243864
2016-11-01Implement P0136R1, Rewording inheriting constructors.Jason Merrill1-42/+173
gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-10-07re PR c++/64433 (Segmentation fault while compiling)Nathan Sidwell1-8/+12
cp/ PR c++/64433 DR1658, DR1611 * init.c (emit_mem_initializers): Don't construct vbases of abstract classes. (push_base_cleanups): Don't push vbase cleanups for abstract class when in C++14 mode. * method.c (synthethesized_method_walk): Don't walk vbases of abstract classes when in C++14 mode. testsuite/ PR c++/66443 * g++.dg/cpp0x/pr66443-cxx11.C: New. * g++.dg/cpp0x/pr66443-cxx11-2.C: New. * g++.dg/cpp1y/pr66443-cxx14.C: New * g++.dg/cpp1y/pr66443-cxx14-2.C: New. * g++.dg/cpp1y/pr66443-cxx14-3.C: New. From-SVN: r240874
2016-10-04extend.texi (Java Exceptions): Remove.Jakub Jelinek1-1/+1
* doc/extend.texi (Java Exceptions): Remove. (java_interface): Remove. cp/ * cp-tree.h (enum cp_tree_index): Remove CPTI_JAVA_*, CPTI_LANG_NAME_JAVA and CPTI_JCLASS. (java_byte_type_node, java_short_type_node, java_int_type_node, java_long_type_node, java_float_type_node, java_double_type_node, java_char_type_node, java_boolean_type_node, lang_name_java, jclass_node): Remove. (enum languages): Remove lang_java. (TYPE_FOR_JAVA): Remove. (struct lang_type_class): Remove java_interface bit-field. (TYPE_JAVA_INTERFACE): Remove. (pragma_java_exceptions): Remove. (check_java_method, build_java_class_ref): Remove prototypes. * name-lookup.c (pushtag_1): Don't set TYPE_FOR_JAVA. * decl2.c (acceptable_java_type, check_java_method): Remove. (import_export_decl): Remove TYPE_FOR_JAVA handling. (build_java_method_aliases): Remove. (c_parse_final_cleanups): Don't call build_java_method_aliases. (possibly_inlined_p): Don't test pragma_java_exceptions. * init.c (build_new_1): Remove TYPE_FOR_JAVA handling. (build_java_class_ref): Remove. * pt.c (maybe_new_partial_specialization, lookup_template_class_1, instantiate_class_template_1): Don't copy TYPE_FOR_JAVA. * except.c (eh_type_info): Remove java type handling. (decl_is_java_type, choose_personality_routine): Remove. (initialize_handler_parm): Don't call choose_personality_routine. (expand_start_catch_block): Don't handle java types. (build_throw): Likewise. * cp-lang.c (cp_eh_personality): Don't handle pragma_java_exceptions. * typeck.c (structural_comptypes): Don't compare TYPE_FOR_JAVA. * call.c (build_over_call): Don't handle TYPE_JAVA_INTERFACE. (java_iface_lookup_fn): Remove. (build_java_interface_fn_ref): Remove. * tree.c (cxx_attribute_table): Remove java_interface. (handle_java_interface_attribute): Remove. * lex.c (pragma_java_exceptions): Remove. (init_cp_pragma): Don't register GCC java_exceptions pragma. (handle_pragma_java_exceptions): Remove. (retrofit_lang_decl): Don't handle lang_name_java. * method.c (implicitly_declare_fn): Don't handle TYPE_FOR_JAVA. * error.c (language_to_string): Don't handle lang_java. * decl.c (record_builtin_java_type): Remove. (initialize_predefined_identifiers): Remove Java. (cxx_init_decl_processing): Remove java_*_type_node. (cp_finish_decl): Don't handle TYPE_FOR_JAVA. (grokfndecl): Likewise. (check_special_function_return_type): Likewise. (grokdeclarator): Don't set TYPE_FOR_JAVA. (grokparms): Don't handle TYPE_FOR_JAVA. (xref_basetypes): Likewise. (check_function_type): Likewise. (finish_constructor_body): Likewise. * mangle.c (write_builtin_type): Don't handle TYPE_FOR_JAVA and java_*_type_node. (write_bare_function_type): Don't handle TYPE_FOR_JAVA. (write_java_integer_type_codes): Remove. * class.c (add_method): Don't handle TYPE_FOR_JAVA. (add_implicitly_declared_members, determine_key_method, finish_struct_1): Likewise. (push_lang_context): Don't handle lang_name_java. testsuite/ * g++.dg/other/java3.C: Remove. * g++.dg/other/java1.C: Remove. * g++.dg/other/error12.C: Remove. * g++.dg/other/java2.C: Remove. * g++.dg/warn/Wnvdtor.C: Remove. * g++.dg/lookup/java1.C: Remove. * g++.dg/lookup/java2.C: Remove. * g++.dg/ext/pr34829.C: Remove. * g++.dg/ext/java-3.C: Remove. * g++.dg/ext/java-1.C: Remove. * g++.dg/ext/java-2.C: Remove. * g++.old-deja/g++.oliva/dwarf2.C: Remove. From-SVN: r240750
2016-09-26init.c (expand_default_init): Fix } indentation.Nathan Sidwell1-13/+5
* init.c (expand_default_init): Fix } indentation. * method.c (process_subob_fn): Simplify control structure to remove gotos. (implicitly_declare_fn): Remove duplicated lambda ctor check. From-SVN: r240489
2016-08-29PR c++/77379 - ABI tag on thunkJason Merrill1-1/+1
* mangle.c (maybe_check_abi_tags): Add version parm, handle thunks. (mangle_thunk): Add thunk parameter. * method.c (finish_thunk): Pass it. * cp-tree.h: Declare it. From-SVN: r239830
2016-08-12re PR c/7652 (-Wswitch-break : Warn if a switch case falls through)Marek Polacek1-0/+1
PR c/7652 gcc/ * alias.c (find_base_value): Adjust fall through comment. * cfgexpand.c (expand_debug_expr): Likewise. * combine.c (find_split_point): Likewise. (expand_compound_operation): Likewise. Add FALLTHRU. (make_compound_operation): Adjust fall through comment. (canon_reg_for_combine): Add FALLTHRU. (force_to_mode): Adjust fall through comment. (simplify_shift_const_1): Likewise. (simplify_comparison): Likewise. * config/aarch64/aarch64-builtins.c (aarch64_simd_expand_args): Add FALLTHRU. * config/aarch64/predicates.md: Likewise. * config/i386/i386.c (function_arg_advance_32): Likewise. (ix86_gimplify_va_arg): Likewise. (print_reg): Likewise. (ix86_print_operand): Likewise. (ix86_build_const_vector): Likewise. (ix86_expand_branch): Likewise. (ix86_sched_init_global): Adjust fall through comment. (ix86_expand_args_builtin): Add FALLTHRU. (ix86_expand_builtin): Likewise. (ix86_expand_vector_init_one_var): Likewise. * config/rs6000/rs6000.c (rs6000_emit_vector_compare_inner): Likewise. (rs6000_adjust_cost): Likewise. (insn_must_be_first_in_group): Likewise. * config/rs6000/rs6000.md: Likewise. Adjust fall through comment. * dbxout.c (dbxout_symbol): Adjust fall through comment. * df-scan.c (df_uses_record): Likewise. * dojump.c (do_jump): Add FALLTHRU. * dwarf2out.c (mem_loc_descriptor): Likewise. Adjust fall through comment. (resolve_args_picking_1): Adjust fall through comment. (loc_list_from_tree_1): Likewise. * expmed.c (make_tree): Likewise. * expr.c (expand_expr_real_2): Add FALLTHRU. (expand_expr_real_1): Likewise. Adjust fall through comment. * fold-const.c (const_binop): Adjust fall through comment. (fold_truth_not_expr): Likewise. (fold_cond_expr_with_comparison): Add FALLTHRU. (fold_binary_loc): Likewise. (contains_label_1): Adjust fall through comment. (multiple_of_p): Likewise. * gcov-tool.c (process_args): Add FALLTHRU. * genattrtab.c (check_attr_test): Likewise. (write_test_expr): Likewise. * genconfig.c (walk_insn_part): Likewise. * genpreds.c (validate_exp): Adjust fall through comment. (needs_variable): Likewise. * gensupport.c (get_alternatives_number): Add FALLTHRU. (subst_dup): Likewise. * gimple-pretty-print.c (dump_gimple_assign): Likewise. * gimplify.c (gimplify_addr_expr): Adjust fall through comment. (gimplify_scan_omp_clauses): Add FALLTHRU. (goa_stabilize_expr): Likewise. * graphite-isl-ast-to-gimple.c (substitute_ssa_name): Adjust fall through comment. * hsa-gen.c (get_address_from_value): Likewise. * ipa-icf.c (sem_function::hash_stmt): Likewise. * ira.c (ira_setup_alts): Add FALLTHRU. * lra-eliminations.c (lra_eliminate_regs_1): Adjust fall through comment. * lto-streamer-out.c (lto_output_tree_ref): Add FALLTHRU. * opts.c (common_handle_option): Likewise. * read-rtl.c (read_rtx_code): Likewise. * real.c (round_for_format): Likewise. * recog.c (asm_operand_ok): Likewise. * reginfo.c (reg_scan_mark_refs): Adjust fall through comment. * reload1.c (set_label_offsets): Likewise. (eliminate_regs_1): Likewise. (reload_reg_reaches_end_p): Likewise. * rtlanal.c (commutative_operand_precedence): Add FALLTHRU. (rtx_cost): Likewise. * sched-rgn.c (is_exception_free): Likewise. * simplify-rtx.c (simplify_rtx): Adjust fall through comment. * stor-layout.c (int_mode_for_mode): Likewise. * toplev.c (print_to_asm_out_file): Likewise. (print_to_stderr): Likewise. * tree-cfg.c (gimple_verify_flow_info): Likewise. * tree-chrec.c (chrec_fold_plus_1): Add FALLTHRU. (chrec_fold_multiply): Likewise. (evolution_function_is_invariant_rec_p): Likewise. (for_each_scev_op): Likewise. * tree-data-ref.c (siv_subscript_p): Likewise. (get_references_in_stmt): Likewise. * tree.c (find_placeholder_in_expr): Adjust fall through comment. (substitute_in_expr): Likewise. (type_cache_hasher::equal): Likewise. (walk_type_fields): Likewise. * var-tracking.c (adjust_mems): Add FALLTHRU. (set_dv_changed): Adjust fall through comment. * varasm.c (default_function_section): Add FALLTHRU. gcc/c-family/ * c-common.c (scalar_to_vector): Adjust fall through comment. * c-opts.c (c_common_handle_option): Likewise. * c-pragma.c (handle_pragma_pack): Add FALLTHRU. * c-pretty-print.c (c_pretty_printer::postfix_expression): Adjust fall through comment. * cilk.c (extract_free_variables): Add FALLTHRU. gcc/c/ * c-parser.c (c_parser_external_declaration): Add FALLTHRU. (c_parser_postfix_expression): Likewise. * c-typeck.c (build_unary_op): Adjust fall through comment. (c_mark_addressable): Likewise. gcc/cp/ * call.c (add_builtin_candidate): Add FALLTHRU. (build_integral_nontype_arg_conv): Adjust fall through comment. (build_new_op_1): Add FALLTHRU. (convert_like_real): Adjust fall through comment. * class.c (fixed_type_or_null): Likewise. * constexpr.c (cxx_eval_constant_expression): Likewise. (potential_constant_expression_1): Likewise. Add FALLTHRU. * cp-gimplify.c (cp_gimplify_expr): Adjust fall through comment. (cp_fold): Add FALLTHRU. * cvt.c (build_expr_type_conversion): Adjust fall through comment. * cxx-pretty-print.c (pp_cxx_unqualified_id): Add FALLTHRU. (pp_cxx_qualified_id): Likewise. (cxx_pretty_printer::constant): Adjust fall through comment. (cxx_pretty_printer::primary_expression): Add FALLTHRU. (pp_cxx_pm_expression): Adjust fall through comment. (cxx_pretty_printer::expression): Add FALLTHRU. (cxx_pretty_printer::declaration_specifiers): Reformat code. (pp_cxx_type_specifier_seq): Adjust fall through comment. (pp_cxx_ptr_operator): Likewise. Add FALLTHRU. * error.c (dump_type): Adjust fall through comment. (dump_decl): Likewise. * mangle.c (write_type): Likewise. * method.c (synthesized_method_walk): Add FALLTHRU. * name-lookup.c (arg_assoc_type): Likewise. * parser.c (cp_lexer_print_token): Adjust fall through comment. (cp_parser_primary_expression): Add FALLTHRU. (cp_parser_operator): Likewise. * pt.c (find_parameter_packs_r): Likewise. (tsubst_aggr_type): Adjust fall through comment. * semantics.c (finish_omp_clauses): Add FALLTHRU. * tree.c (lvalue_kind): Likewise. gcc/fortran/ * decl.c (match_attr_spec): Add FALLTHRU. * primary.c (match_arg_list_function): Likewise. * resolve.c (resolve_operator): Adjust fall through comment. (fixup_charlen): Add FALLTHRU. (resolve_allocate_expr): Adjust fall through comment. * trans-array.c (gfc_conv_ss_startstride): Add FALLTHRU. * trans-intrinsic.c (gfc_conv_intrinsic_len): Adjust fall through comment. gcc/java/ * expr.c (java_truthvalue_conversion): Adjust fall through comment. * jcf-io.c (verify_constant_pool): Likewise. * typeck.c (promote_type): Likewise. gcc/objc/ * objc-encoding.c (encode_type): Add FALLTHRU. libcpp/ * lex.c (search_line_fast): Add FALLTHRU. (_cpp_lex_direct): Likewise. (cpp_token_val_index): Adjust fall through comment. * macro.c (parse_params): Add FALLTHRU. * pch.c (count_defs): Adjust fall through comment. (write_defs): Likewise. libiberty/ * cp-demangle.c (d_print_mod): Add FALLTHRU. From-SVN: r239410
2016-07-21call.c (build_over_call): Check unsafe_copy_elision_p even for trivial ↵Jason Merrill1-7/+25
constructors. * call.c (build_over_call): Check unsafe_copy_elision_p even for trivial constructors. * method.c (do_build_copy_constructor): Don't copy tail padding even in a trivial constructor. From-SVN: r238620
2016-05-23re PR c++/70972 (Inheriting constructors taking parameters by value should ↵Paolo Carlini1-0/+2
move them, not copy) /cp 2016-05-23 Paolo Carlini <paolo.carlini@oracle.com> PR c++/70972 * method.c (forward_parm): Use cp_build_reference_type. /testsuite 2016-05-23 Paolo Carlini <paolo.carlini@oracle.com> PR c++/70972 * g++.dg/cpp0x/inh-ctor20.C: New. * g++.dg/cpp0x/inh-ctor21.C: Likewise. From-SVN: r236614
2016-05-12re PR c/70756 (Wrong column number shown for "error: invalid use of flexible ↵Marek Polacek1-2/+2
array member") PR c/70756 * c-common.c (pointer_int_sum): Call size_in_bytes_loc instead of size_in_bytes and pass LOC to it. * c-decl.c (build_compound_literal): Pass LOC down to c_incomplete_type_error. * c-tree.h (require_complete_type): Adjust declaration. (c_incomplete_type_error): Likewise. * c-typeck.c (require_complete_type): Add location parameter, pass it down to c_incomplete_type_error. (c_incomplete_type_error): Add location parameter, pass it down to error_at. (build_component_ref): Pass location down to c_incomplete_type_error. (default_conversion): Pass location down to require_complete_type. (build_array_ref): Likewise. (build_function_call_vec): Likewise. (convert_arguments): Likewise. (build_unary_op): Likewise. (build_c_cast): Likewise. (build_modify_expr): Likewise. (convert_for_assignment): Likewise. (c_finish_omp_clauses): Likewise. * call.c (build_new_op_1): Pass LOC to cp_build_modify_expr. * cp-tree.h (cp_build_modify_expr): Update declaration. (cxx_incomplete_type_error, cxx_incomplete_type_diagnostic): New inline overloads. * cp-ubsan.c (cp_ubsan_dfs_initialize_vtbl_ptrs): Pass INPUT_LOCATION to cp_build_modify_expr. * decl2.c (set_guard): Likewise. (handle_tls_init): Likewise. * init.c (perform_member_init): Likewise. (expand_virtual_init): Likewise. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (get_temp_regvar): Likewise. (build_vec_init): Likewise. * method.c (do_build_copy_assign): Likewise. (assignable_expr): Likewise. * semantics.c (finish_omp_for): Likewise. * typeck.c (cp_build_binary_op): Pass LOCATION to pointer_diff and cp_pointer_int_sum. (cp_pointer_int_sum): Add location parameter. Pass it down to pointer_int_sum. (pointer_diff): Add location parameter. Use it. (build_modify_expr): Pass location down to cp_build_modify_expr. (cp_build_modify_expr): Add location parameter. Use it. (build_x_modify_expr): Pass location down to cp_build_modify_expr. * typeck2.c (cxx_incomplete_type_diagnostic, cxx_incomplete_type_error): Add location parameter. * langhooks-def.h (lhd_incomplete_type_error): Adjust declaration. * langhooks.c (lhd_incomplete_type_error): Add location parameter. * langhooks.h (incomplete_type_error): Likewise. * tree.c (size_in_bytes_loc): Renamed from size_in_bytes. Add location parameter, pass it down to incomplete_type_error. * tree.h (size_in_bytes): New inline overload. (size_in_bytes_loc): Renamed from size_in_bytes. * c-c++-common/pr70756-2.c: New test. * c-c++-common/pr70756.c: New test. From-SVN: r236180
2016-04-28cvt.c (cp_get_callee): New.Jason Merrill1-6/+2
* cvt.c (cp_get_callee): New. * constexpr.c (get_function_named_in_call): Use it. * cxx-pretty-print.c (postfix_expression): Use it. * except.c (check_noexcept_r): Use it. * method.c (check_nontriv): Use it. * tree.c (build_aggr_init_expr): Use it. * cp-tree.h: Declare it. From-SVN: r235596
2016-04-18tree.h (TYPE_ALIGN, DECL_ALIGN): Return shifted amount.Michael Matz1-1/+1
* tree.h (TYPE_ALIGN, DECL_ALIGN): Return shifted amount. (SET_TYPE_ALIGN, SET_DECL_ALIGN): New. * tree-core.h (tree_type_common.align): Use bit-field. (tree_type_common.spare): New. (tree_decl_common.off_align): Make smaller. (tree_decl_common.align): Use bit-field. * expr.c (expand_expr_addr_expr_1): Use SET_TYPE_ALIGN. * omp-low.c (install_var_field): Use SET_DECL_ALIGN. (scan_sharing_clauses): Ditto. (finish_taskreg_scan): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (omp_finish_file): Ditto. * stor-layout.c (do_type_align): Use SET_DECL_ALIGN. (layout_decl): Ditto. (relayout_decl): Ditto. (finalize_record_size): Use SET_TYPE_ALIGN. (finalize_type_size): Ditto. (finish_builtin_struct): Ditto. (layout_type): Ditto. (initialize_sizetypes): Ditto. * targhooks.c (std_gimplify_va_arg_expr): Use SET_TYPE_ALIGN. * tree-nested.c (insert_field_into_struct): Use SET_TYPE_ALIGN. (lookup_field_for_decl): Use SET_DECL_ALIGN. (get_chain_field): Ditto. (get_trampoline_type): Ditto. (get_nl_goto_field): Ditto. * tree-streamer-in.c (unpack_ts_decl_common_value_fields): Use SET_DECL_ALIGN. (unpack_ts_type_common_value_fields): Use SET_TYPE_ALIGN. * gimple-expr.c (copy_var_decl): Use SET_DECL_ALIGN. * tree.c (make_node_stat): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (build_qualified_type): Use SET_TYPE_ALIGN. (build_aligned_type, build_range_type_1): Ditto. (build_atomic_base): Ditto. (build_common_tree_nodes): Ditto. * cfgexpand.c (align_local_variable): Use SET_DECL_ALIGN. (expand_one_stack_var_at): Ditto. * coverage.c (build_var): Use SET_DECL_ALIGN. * except.c (init_eh): Ditto. * function.c (assign_parm_setup_block): Ditto. * symtab.c (increase_alignment_1): Ditto. * tree-ssa-ccp.c (fold_builtin_alloca_with_align): Ditto. * tree-vect-stmts.c (ensure_base_align): Ditto. * varasm.c (align_variable): Ditto. (assemble_variable): Ditto. (build_constant_desc): Ditto. (output_constant_def_contents): Ditto. * config/arm/arm.c (arm_relayout_function): Use SET_DECL_ALIGN. * config/avr/avr.c (avr_adjust_type_node): Use SET_TYPE_ALIGN. * config/mips/mips.c (mips_std_gimplify_va_arg_expr): Ditto. * config/msp430/msp430.c (msp430_gimplify_va_arg_expr): Ditto. * config/spu/spu.c (spu_build_builtin_va_list): Use SET_DECL_ALIGN. ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): Use SET_TYPE_ALIGN. (gnat_to_gnu_field): Ditto. (components_to_record): Ditto. (create_variant_part_from): Ditto. (copy_and_substitute_in_size): Ditto. (substitute_in_type): Ditto. * gcc-interface/utils.c (make_aligning_type): Use SET_TYPE_ALIGN. (make_packable_type): Ditto. (maybe_pad_type): Ditto. (finish_fat_pointer_type): Ditto. (finish_record_type): Ditto and use SET_DECL_ALIGN. (rest_of_record_type_compilation): Use SET_TYPE_ALIGN. (create_field_decl): Use SET_DECL_ALIGN. c-family/ * c-common.c (handle_aligned_attribute): Use SET_TYPE_ALIGN and SET_DECL_ALIGN. c/ * c-decl.c (merge_decls): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (grokdeclarator, parser_xref_tag, finish_enum): Use SET_TYPE_ALIGN. cp/ * class.c (build_vtable): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (layout_class_type): Ditto. (build_base_field): Use SET_DECL_ALIGN. (fixup_attribute_variants): Use SET_TYPE_ALIGN. * decl.c (duplicate_decls): Use SET_DECL_ALIGN. (record_unknown_type): Use SET_TYPE_ALIGN. (cxx_init_decl_processing): Ditto. (copy_type_enum): Ditto. (grokfndecl): Use SET_DECL_ALIGN. (copy_type_enum): Use SET_TYPE_ALIGN. * pt.c (instantiate_class_template_1): Use SET_TYPE_ALIGN. (tsubst): Ditto. * tree.c (cp_build_qualified_type_real): Use SET_TYPE_ALIGN. * lambda.c (maybe_add_lambda_conv_op): Use SET_DECL_ALIGN. * method.c (implicitly_declare_fn): Use SET_DECL_ALIGN. * rtti.c (emit_tinfo_decl): Ditto. fortran/ * trans-io.c (gfc_build_io_library_fndecls): Use SET_TYPE_ALIGN. * trans-common.c (build_common_decl): Use SET_DECL_ALIGN. * trans-types.c (gfc_add_field_to_struct): Use SET_DECL_ALIGN. go/ * go-gcc.cc (Gcc_backend::implicit_variable): Use SET_DECL_ALIGN. java/ * class.c (add_method_1): Use SET_DECL_ALIGN. (make_class_data): Ditto. (emit_register_classes_in_jcr_section): Ditto. * typeck.c (build_java_array_type): Ditto. objc/ * objc-act.c (objc_build_struct): Use SET_DECL_ALIGN. libcc1/ * plugin.cc (plugin_finish_record_or_union): Use SET_TYPE_ALIGN. From-SVN: r235172
2016-03-03* method.c (synthesized_method_walk): operator= can also be constexpr.Jason Merrill1-2/+11
From-SVN: r233956
2016-02-25re PR c++/69842 (Parameter deduction in polymorphic lambdas)Jason Merrill1-3/+6
PR c++/69842 * method.c (forward_parm): Handle parameter packs. * lambda.c (maybe_add_lambda_conv_op): Use it for them. From-SVN: r233719
2016-02-17re PR c++/69842 (Parameter deduction in polymorphic lambdas)Jason Merrill1-4/+14
PR c++/69842 * method.c (forward_parm): Split out from... (add_one_base_init): ...here. * lambda.c (maybe_add_lambda_conv_op): Use it. From-SVN: r233506
2016-01-11re PR c++/69131 (default constructor of union incorrectly deleted)Jason Merrill1-10/+13
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. From-SVN: r232243
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055