aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
AgeCommit message (Collapse)AuthorFilesLines
2016-01-14Mark symbols in offload tables with force_output in read_offload_tablesTom de Vries2-8/+8
2016-01-14 Tom de Vries <tom@codesourcery.com> PR tree-optimization/68773 * c-parser.c (c_parser_oacc_declare, c_parser_omp_declare_target): Don't set force_output. * parser.c (cp_parser_oacc_declare, cp_parser_omp_declare_target): Don't set force_output. * omp-low.c (expand_omp_target): Don't set force_output. * varpool.c (varpool_node::get_create): Same. * lto-cgraph.c (input_offload_tables): Mark entries in offload_vars and offload_funcs with force_output. From-SVN: r232384
2016-01-14re PR c++/69261 (Copying char arrays during constexpr evaluation does not ↵Jason Merrill2-2/+50
work reliably) PR c++/69261 * constexpr.c (find_array_ctor_elt): Handle splitting RANGE_EXPR. From-SVN: r232370
2016-01-13Improve warning locations (PR66208)Bernd Schmidt2-2/+2
PR c/66208 * c-common.c (check_function_nonnull): Remove unnecessary declaration. Add new arg loc and pass it down as context. (check_nonnull_arg): Don't mark ctx arg as unused. Use it as a pointer to the location to use for the warning. (check_function_arguments): New arg loc. All callers changed. Pass it to check_function_nonnull. * c-common.h (check_function_arguments): Adjust declaration. testsuite/ PR c/66208 * c-c++-common/pr66208.c: New file. From-SVN: r232345
2016-01-12re PR c++/68979 (error: left operand of shift expression ‘(-1 << 4)’ is ↵Marek Polacek2-13/+20
negative) PR c++/68979 * constexpr.c (cxx_eval_check_shift_p): Use permerror rather than error_at and adjust the return value. * g++.dg/warn/permissive-1.C: New test. From-SVN: r232280
2016-01-12re PR objc++/68511 (FAIL: obj-c++.dg/property/dotsyntax-11.mm -fgnu-runtime ↵Jakub Jelinek2-6/+15
(test for errors, line 51,56,59)) PR objc++/68511 PR c++/69213 * cp-gimplify.c (cp_gimplify_expr) <case INIT_EXPR>: Don't return GS_ERROR whenever seen_error (), only if *expr_p contains cilk spawn stmt, but cilk_detect_spawn_and_unwrap failed. * g++.dg/opt/pr69213.C: New test. From-SVN: r232278
2016-01-12re PR c++/66808 (tree check fail in symbol_table::decl_assembler_name_hash)Jakub Jelinek2-2/+13
PR c++/66808 PR c++/69000 * pt.c (tsubst_decl): If not local_p, clear DECL_TEMPLATE_INFO. * g++.dg/tls/pr66808.C: New test. * g++.dg/tls/pr69000.C: New test. From-SVN: r232259
2016-01-11re PR c++/69131 (default constructor of union incorrectly deleted)Jason Merrill2-10/+20
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-11PR c++/68795: fix uninitialized close_paren_loc in cp_parser_postfix_expressionDavid Malcolm2-6/+22
gcc/cp/ChangeLog: 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. From-SVN: r232238
2016-01-11re PR c++/69211 (g++ ICE on x86_64-linux-gnu (verify_gimple failed))Jakub Jelinek2-1/+13
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. * g++.dg/opt/pr69211.C: New test. From-SVN: r232237
2016-01-09re PR c++/69113 (ICE: in vague_linkage_p, at cp/decl2.c:1875 with -fno-weak)Marek Polacek2-1/+7
PR c++/69113 * decl2.c (comdat_linkage): Only set DECL_COMDAT if TREE_PUBLIC is set. * g++.dg/pr69113.C: New test. From-SVN: r232189
2016-01-09re PR tree-optimization/69164 (ICE in create_tmp_var, at gimple-expr.c:468)Jakub Jelinek2-9/+7
PR c++/69164 * class.c (layout_class_type): Use copy_node to copy FIELD_DECLs. * g++.dg/opt/pr69164.C: New test. From-SVN: r232187
2016-01-09re PR c++/69158 (ICE in in cxx_eval_indirect_ref, at cp/constexpr.c:2598)Jason Merrill2-1/+15
PR c++/69158 * constexpr.c (cxx_fold_indirect_ref): Handle array type differing in completion. From-SVN: r232186
2016-01-08re PR c++/68449 (ICE in cxx_eval_constant_expression on atomic_load in C++)Marek Polacek2-1/+7
PR c++/68449 * constexpr.c (cxx_eval_constant_expression): Handle NULL initializer. * g++.dg/pr68449.C: New. From-SVN: r232176
2016-01-08constexpr.c (cxx_eval_call_expression): Remove convert_to_void workaround.Jason Merrill2-10/+3
* constexpr.c (cxx_eval_call_expression): Remove convert_to_void workaround. From-SVN: r232168
2016-01-08PR c++/68983 (BE)Jason Merrill2-2/+8
PR c++/67557 gcc/ * function.c (assign_temp): Guard against TREE_ADDRESSABLE types here. * expr.c (store_field): Not here. * tree-cfgcleanup.c (fixup_noreturn_call): Don't clear LHS of a call with TREE_ADDRESSABLE type. * tree-cfg.c (verify_gimple_call): Adjust. gcc/cp/ * cvt.c (convert_to_void): Don't strip a TARGET_EXPR of TREE_ADDRESSABLE type. From-SVN: r232167
2016-01-08PR c++/68983 (FE)Jason Merrill2-0/+9
PR c++/67557 * call.c (unsafe_copy_elision_p): Look through COMPOUND_EXPR. From-SVN: r232166
2016-01-05re PR c++/58583 ([c++11] ICE with invalid non-static data member ↵Nathan Sidwell2-3/+13
initialization in template) gcc/cp/ PR c++/58583 * pt.c (build_non_dependent_expr): Don't try a checking fold when parsing an nsdmi. gcc/testsuite/ PR c++/58583 * g++.dg/cpp0x/nsdmi-template14.C: Adjust test & errors. From-SVN: r232075
2016-01-04Update copyright years.Jakub Jelinek56-4277/+4286
From-SVN: r232055
2015-12-24re PR c++/69005 (infinite(?) recursion in template instantiations)Jason Merrill2-22/+36
PR c++/69005 * call.c (add_template_candidate_real): Don't try to deduce X(X). From-SVN: r231952
2015-12-23Merge OMP_CLAUSE_USE_DEVICE into OMP_CLAUSE_USE_DEVICE_PTRThomas Schwinge3-4/+1
gcc/c/ * c-parser.c (c_parser_oacc_clause_use_device): Merge function into... (c_parser_omp_clause_use_device_ptr): ... this function. Adjust all users. gcc/ * tree-core.h (enum omp_clause_code): Merge OMP_CLAUSE_USE_DEVICE into OMP_CLAUSE_USE_DEVICE_PTR. Adjust all users. From-SVN: r231926
2015-12-22re PR c++/66921 (failure to determine size of static constexpr array that is ↵Jason Merrill2-1/+6
nested within a templated class) PR c++/66921 * decl.c (cp_complete_array_type): Allow an initializer that already has array type. From-SVN: r231914
2015-12-22re PR c++/67257 (Internal compiler error in retrieve_specialization)Jason Merrill2-1/+19
PR c++/67257 * parser.c (cp_parser_single_declaration): Reject a class template that also declares a variable. From-SVN: r231913
2015-12-22re PR c++/67339 (Segfault when parsing a typename involving a template-alias)Jason Merrill2-1/+7
PR c++/67339 * parser.c (cp_parser_elaborated_type_specifier): Use CLASS_TYPE_P rather than check for RECORD_TYPE. From-SVN: r231912
2015-12-22Fix read of uninitialized value in make_pack_expansion()Patrick Palka2-0/+7
gcc/cp/ChangeLog: * pt.c (make_pack_expansion): Make sure to initialize ppd.type_pack_expansion_p. From-SVN: r231904
2015-12-21C and C++ FE: fix source ranges for binary opsDavid Malcolm2-3/+19
gcc/c-family/ChangeLog: * c-common.c (binary_op_error): Convert first param from location_t to rich_location * and use it when emitting an error. * c-common.h (binary_op_error): Convert first param from location_t to rich_location *. gcc/c/ChangeLog: * c-typeck.c: Include "gcc-rich-location.h". (build_binary_op): In the two places that call binary_op_error, create a gcc_rich_location and populate it with the location of the binary op and its two operands. gcc/cp/ChangeLog: * typeck.c (cp_build_binary_op): Update for change in signature of build_binary_op. Use error_at to replace an implicit use of input_location with param "location" in "invalid operands" error. (cp_build_binary_op): Replace an error with an error_at, using "location", rather than implicitly using input_location. gcc/testsuite/ChangeLog: * g++.dg/diagnostic/bad-binary-ops.C: New test case. * gcc.dg/bad-binary-ops.c: New test case. gcc.dg/plugin/diagnostic_plugin_show_trees.c (get_range_for_expr): Remove material copied from gcc-rich-location.c (gcc_rich_location::add_expr): Likewise. From-SVN: r231884
2015-12-20re PR c++/67411 (internal compiler error: in tsubst_copy, at cp/pt.c:13473)Jason Merrill2-1/+4
PR c++/67411 * decl2.c (decl_maybe_constant_var_p): Use DECL_HAS_VALUE_EXPR_P. From-SVN: r231869
2015-12-20re PR c++/67411 (internal compiler error: in tsubst_copy, at cp/pt.c:13473)Jason Merrill6-24/+79
PR c++/67411 * lambda.c (generic_lambda_fn_p): Split out from... (maybe_add_lambda_conv_op): ...here. * semantics.c (process_outer_var_ref): Don't defer maybe-constant variables in a generic lambda. * pt.c (instantiate_non_dependent_or_null): New. * init.c (constant_value_1): Use it. * cp-tree.h: Declare it and generic_lambda_fn_p. From-SVN: r231863
2015-12-20re PR c++/67411 (internal compiler error: in tsubst_copy, at cp/pt.c:13473)Jason Merrill2-0/+8
PR c++/67411 * decl2.c (decl_maybe_constant_var_p): A proxy isn't constant. From-SVN: r231862
2015-12-18Fix PR c++/68978 (bogus error: lvalue required as left operand of assignment)Patrick Palka2-0/+11
gcc/cp/ChangeLog: PR c++/68978 * tree.c (lvalue_kind) [MODOP_EXPR]: New case. gcc/testsuite/ChangeLog: PR c++/68978 * g++.dg/template/pr68978.C: New test. From-SVN: r231841
2015-12-18re PR c++/67592 (A virtual member function declared constexpr fails to ↵Paolo Carlini2-7/+22
trigger a diagnostic) /cp 2015-12-18 Paolo Carlini <paolo.carlini@oracle.com> PR c++/67592 * decl.c (grokdeclarator): Reject constexpr virtual member functions; in error messages, prefer %<virtual%> and %<constexpr%> to virtual and constexpr, respectively. /testsuite 2015-12-18 Paolo Carlini <paolo.carlini@oracle.com> PR c++/67592 * g++.dg/cpp0x/constexpr-virtual5.C: New. * g++.dg/cpp0x/pr51463.C: Adjust dg-error string. * g++.dg/inherit/pure1.C: Likewise. From-SVN: r231824
2015-12-18Fix PR c++/68831 (superfluous -Waddress warning for C++ delete)Patrick Palka2-0/+8
gcc/cp/ChangeLog: PR c++/68831 * init.c (build_delete): Use a warning sentinel to disable -Waddress warnings when building the conditional that tests if the operand is NULL. gcc/testsuite/ChangeLog: PR c++/68831 * g++.dg/pr68831.C: New test. From-SVN: r231798
2015-12-17re PR c++/67550 (Initialization of local struct array with elements of ↵Jason Merrill2-0/+9
global array yields zeros instead of initializer values) PR c++/67550 * init.c (constant_value_1): Don't return a CONSTRUCTOR missing non-constant elements. From-SVN: r231777
2015-12-17re PR c++/67576 (expression of typeid( expression ) is evaluated twice)Jason Merrill2-1/+7
PR c++/67576 PR c++/25466 * rtti.c (build_typeid): Use save_expr, not stabilize_reference. From-SVN: r231776
2015-12-17Fix wrong PR referencesPatrick Palka1-1/+1
PR c++/59878 -> PR c++/59879 From-SVN: r231755
2015-12-17Fix some blockers of PR c++/24666 (arrays decay to pointers too early)Patrick Palka2-7/+18
gcc/cp/ChangeLog: PR c++/16333 PR c++/41426 PR c++/59878 PR c++/66895 * typeck.c (convert_for_initialization): Don't perform an early decaying conversion if converting to a class type. gcc/testsuite/ChangeLog: PR c++/16333 PR c++/41426 PR c++/59878 PR c++/66895 * g++.dg/conversion/pr16333.C: New test. * g++.dg/conversion/pr41426.C: New test. * g++.dg/conversion/pr59878.C: New test. * g++.dg/conversion/pr66895.C: New test. From-SVN: r231736
2015-12-17Avoid code duplication in cp_tree_[operand|code]_lengthPatrick Palka2-16/+8
gcc/cp/ChangeLog: * tree.c (cp_tree_operand_length): Define in terms of cp_tree_code_length. From-SVN: r231735
2015-12-16Correct ChangeLogs for PR c++/42121 and related.Martin Sebor1-5/+5
From-SVN: r231734
2015-12-16PR objc++/68932 - FAIL: obj-c++.dg/property/at-property-23.mm -fgnu-runtimeMartin Sebor2-2/+9
PR objc++/68932 - FAIL: obj-c++.dg/property/at-property-23.mm -fgnu-runtime (internal compiler error) cp/ * decl.c (grokdeclarator): Avoid assuming ctype is non-null when checking the validity of a flexible array member. testsuite/ * obj-c++.dg/property/at-property-23.mm: Remove check for an error message. From-SVN: r231726
2015-12-16pt.c (comp_template_args): Remove.Paolo Carlini3-15/+15
2015-12-16 Paolo Carlini <paolo.carlini@oracle.com> * pt.c (comp_template_args): Remove. (comp_template_args_with_info): Rename to comp_template_args; not static. (add_pending_template): Adjust call. * cp-tree.h (comp_template_args): Add default arguments. From-SVN: r231723
2015-12-16re PR c++/68309 (ICE: Segmentation fault)Jason Merrill2-7/+5
PR c++/68309 * pt.c (instantiate_decl): Revert earlier change. From-SVN: r231714
2015-12-16re PR c++/63628 ([c++1y] cannot use decltype on captured arg-pack)Jason Merrill2-6/+15
PR c++/63628 * pt.c (tsubst_pack_expansion): Also make dummy decls if retrieve_local_specialization fails. From-SVN: r231713
2015-12-16Better error recovery for merge-conflict markersDavid Malcolm2-0/+59
gcc/c-family/ChangeLog: * c-common.h (conflict_marker_get_final_tok_kind): New prototype. * c-lex.c (conflict_marker_get_final_tok_kind): New function. gcc/c/ChangeLog: * c-parser.c (struct c_parser): Expand array "tokens_buf" from 2 to 4. (c_parser_peek_nth_token): New function. (c_parser_peek_conflict_marker): New function. (c_parser_error): Detect conflict markers and report them as such. gcc/cp/ChangeLog: * parser.c (cp_lexer_peek_conflict_marker): New function. (cp_parser_error): Detect conflict markers and report them as such. gcc/testsuite/ChangeLog: * c-c++-common/conflict-markers-1.c: New testcase. * c-c++-common/conflict-markers-2.c: Likewise. * c-c++-common/conflict-markers-3.c: Likewise. * c-c++-common/conflict-markers-4.c: Likewise. * c-c++-common/conflict-markers-5.c: Likewise. * c-c++-common/conflict-markers-6.c: Likewise. * c-c++-common/conflict-markers-7.c: Likewise. * c-c++-common/conflict-markers-8.c: Likewise. * c-c++-common/conflict-markers-9.c: Likewise. * c-c++-common/conflict-markers-10.c: Likewise. * c-c++-common/conflict-markers-11.c: Likewise. * g++.dg/conflict-markers-1.C: Likewise. From-SVN: r231712
2015-12-15struct-layout-1_generate.c: Avoid generating further fields after the first ↵Martin Sebor7-37/+386
flexible array member. gcc/testsuite/ChangeLog: 2015-12-15 Martin Sebor <msebor@redhat.com> c++/42121 c++/68478 c++/68613 c++/68689 c++/68710 * g++.dg/compat/struct-layout-1_generate.c: Avoid generating further fields after the first flexible array member. * g++.dg/ext/flexary2.C: Expect a sole flexible array member to be rejected. Add a test case exercising zero-length array. * g++.dg/ext/flexary3.C: Expect a sole flexible array member to be rejected. * g++.dg/ext/flexary.h: New file. * g++.dg/ext/flexary4.C: New file. * g++.dg/ext/flexary5.C: New file. * g++.dg/ext/flexary6.C: New file. * g++.dg/ext/flexary7.C: New file. * g++.dg/ext/flexary8.C: New file. * g++.dg/other/dump-ada-spec-2.C: Adjust to reflect flexible array members. * g++.dg/parse/pr43765.C: Add a member to make a struct with a flexible array member valid. Adjust expected error message. * g++.dg/torture/pr64280.C: Expect a sole flexible array member to be rejected. * g++.dg/torture/pr64312.C: Add a member to make a struct with a flexible array member valid. * g++.dg/ubsan/object-size-1.C: Adjust expected diagnostic. gcc/cp/ChangeLog: 2015-12-15 Martin Sebor <msebor@redhat.com> c++/42121 c++/68478 c++/68613 c++/68689 c++/68710 * class.c (walk_subobject_offsets): Avoid assuming type domain is non-null or has an upper bound. (layout_class_type): Include type size in error message. (flexmems_t): New type. (field_nonempty_p, find_flexarrays, diagnose_flexarrays) (check_flexarrays): New functions. (finish_struct_1): Call check_flexarrays. * decl.c (compute_array_index_type): Distinguish flexible array members from zero-length arrays. (grokdeclarator): Reject flexible array members in unions. Avoid rejecting members of incomplete types that are flexible array members. * error.c (dump_type_suffix): Handle flexible array members with null upper bound. * init.c (perform_member_init): Same. * pt.c (instantiate_class_template_1): Allow flexible array members. (tsubst): Handle flexible array members with null upper bound. * typeck2.c (digest_init_r): Warn for initialization of flexible array members. (process_init_constructor_record): Handle flexible array members. gcc/ChangeLog: 2015-12-15 Martin Sebor <msebor@redhat.com> c++/42121 * tree-chkp.c (chkp_find_bound_slots_1): Handle flexible array members. * tree.c (type_contains_placeholder_1): Avoid assuming type has a non-null domain or an upper bound to handle flexible array members. * varasm.c (output_constructor_regular_field): Same. (output_constructor): Set min_index to integer_zero_node rather than null when a type has no domain to avoid crashing later. From-SVN: r231665
2015-12-15Fix PR c++/21802 (two-stage name lookup fails for operators)Patrick Palka6-22/+217
gcc/cp/ChangeLog: PR c++/21802 PR c++/53223 * cp-tree.h (cp_tree_code_length): Declare. (build_min_non_dep_op_overload): Declare. * tree.c (cp_tree_code_length): Define. (build_min_non_dep_op_overload): Define. (build_win_non_dep_call_vec): Copy the KOENIG_LOOKUP_P flag. * typeck.c (build_x_indirect_ref): Use build_min_non_dep_op_overload when the given expression has been resolved to an operator overload. (build_x_binary_op): Likewise. (build_x_array_ref): Likewise. (build_x_unary_op): Likewise. (build_x_compound_expr): Likewise. (build_x_modify_expr): Likewise. * decl2.c (grok_array_decl): Likewise. * call.c (build_new_op_1): If during template processing we chose an operator overload that is a hidden friend function, set the call's KOENIG_LOOKUP_P flag to 1. gcc/testsuite/ChangeLog: PR c++/21802 PR c++/53223 * g++.dg/cpp0x/pr53223.C: New test. * g++.dg/lookup/pr21802.C: New test. * g++.dg/lookup/two-stage4.C: Remove XFAIL. From-SVN: r231640
2015-12-14re PR c++/68309 (ICE: Segmentation fault)Jason Merrill2-2/+13
PR c++/68309 gcc/ * hash-table.h: Add copy constructor. * hash-map.h: Add copy constructor. gcc/cp/ * pt.c (instantiate_decl): Copy local_specializations for nested function. From-SVN: r231632
2015-12-09re PR c++/60218 ([c++11] ICE using __bases for broken class hierarchy)Paolo Carlini2-7/+20
/cp 2015-12-09 Paolo Carlini <paolo.carlini@oracle.com> PR c++/60218 * semantics.c (calculate_bases_helper): Don't call dfs_walk_all when TYPE_BINFO (type) is null. (calculate_bases): Handle gracefully a null vector->length (). /testsuite 2015-12-09 Paolo Carlini <paolo.carlini@oracle.com> PR c++/60218 * g++.dg/ext/bases2.C: New. From-SVN: r231460
2015-12-09c-omp.c (c_finish_oacc_wait): Remove add_stmt() call.Chung-Lin Tang1-0/+1
2015-12-09 Chung-Lin Tang <cltang@codesourcery.com> * c-family/c-omp.c (c_finish_oacc_wait): Remove add_stmt() call. * c/c-parser.c (c_parser_oacc_wait): Add add_stmt() call. * cp/parser.c (cp_parser_oacc_wait): Add finish_expr_stmt() call. From-SVN: r231441
2015-12-08Fix PR c++/68711 - [6 regression] SEGV on an invalid offsetof of a memberMartin Sebor2-2/+11
of a virtual base. gcc/testsuite/ChangeLog: * g++.dg/other/offsetof8.C: New test. gcc/cp/ChangeLog: * typeck.c (build_class_member_access_expr): Strip NOPs before testing a potentially null operand for equality to zero. From-SVN: r231437
2015-12-07re PR c++/68760 (ICE in pp_string (pretty-print.c:909))Jakub Jelinek2-1/+7
PR c++/68760 * error.c (dump_global_iord): Use DECL_SOURCE_FILE (t) instead of LOCATION_FILE (input_location). * g++.dg/tree-ssa/pr68760.C: New test. From-SVN: r231386
2015-12-07re PR c++/68683 ([concepts] function satisfy_argument_deduction_constraint ↵Ryan Burn2-0/+10
modifies a type tree node but leaves TYPE_CANONICAL unchanged) PR c++/68683 * constraint.cc (satisfy_argument_deduction_constraint): Set TYPE_CANONICAL to NULL_TREE if PLACEHOLDER_TYPE_CONSTRAINTS are changed. From-SVN: r231385