summaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
AgeCommit message (Collapse)Author
2017-12-16 Backported from mainlinejakub
2017-12-15 Jakub Jelinek <jakub@redhat.com> PR c++/81197 * cp-tree.h (cp_maybe_mangle_decomp): Declare. * decl.c (cp_maybe_mangle_decomp): New function. (cp_finish_decomp): Don't SET_DECL_ASSEMBLER_NAME here. * parser.c (cp_convert_range_for, cp_parser_decomposition_declaration): Call cp_maybe_mangle_decomp. * pt.c (tsubst_expr): Likewise. * mangle.c (find_decomp_unqualified_name): New function. (write_unqualified_name): Handle DECL_DECOMPOSITION_P where DECL_ASSEMBLER_NAME is already set. * g++.dg/cpp1z/decomp34.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@255735 138bc75d-0d04-0410-961f-82ee72b054a4
2017-12-15 Backported from mainlinejakub
2017-11-27 Jakub Jelinek <jakub@redhat.com> PR c++/81888 * parser.c (cp_parser_decomposition_declaration): Reject just BRACE_ENCLOSED_INITIALIZER_P initializers with nelts != 1 rather than all such CONSTRUCTORs, and only if is_direct_init is true. * g++.dg/cpp1z/decomp30.C: Add a test for structured binding with = {} and = { a, a } initializers. * g++.dg/cpp1z/decomp31.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@255719 138bc75d-0d04-0410-961f-82ee72b054a4
2017-12-15 Backported from mainlinejakub
2017-11-23 Jakub Jelinek <jakub@redhat.com> * parser.c (cp_parser_omp_declare): Change return type to bool from void, return true for declare simd. (cp_parser_pragma): Return cp_parser_omp_declare returned value rather than always false. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@255713 138bc75d-0d04-0410-961f-82ee72b054a4
2017-09-18 PR c++/81236 - ICE with template-id in generic lambdajason
* parser.c (parsing_default_capturing_generic_lambda): Don't check for enclosing template. * semantics.c (finish_qualified_id_expr): Call it. * cp-tree.h: Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@252946 138bc75d-0d04-0410-961f-82ee72b054a4
2017-07-17 Backported from mainlinejakub
2017-07-04 Jakub Jelinek <jakub@redhat.com> PR c++/81258 * parser.c (cp_parser_decomposition_declaration): Diagnose invalid forms of structured binding initializers. * g++.dg/cpp1z/decomp21.C (foo): Adjust expected diagnostics. * g++.dg/cpp1z/decomp30.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@250286 138bc75d-0d04-0410-961f-82ee72b054a4
2017-07-06 PR c++/81204 - parse error with dependent template-namejason
* parser.c (cp_parser_lookup_name): Revert previous change. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@250038 138bc75d-0d04-0410-961f-82ee72b054a4
2017-06-30 PR c++/54769 - wrong lookup of dependent template-name.jason
PR c++/81257 - ICE with invalid ::template. * parser.c (cp_parser_template_name): Handle dependent object type. (cp_parser_nested_name_specifier_opt): Make template_keyword_p a parameter. (cp_parser_id_expression): Pass it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@249857 138bc75d-0d04-0410-961f-82ee72b054a4
2017-06-28 PR c++/81204 - parse error with dependent template-namejason
* parser.c (cp_parser_lookup_name): Disqualify function templates after lookup. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@249761 138bc75d-0d04-0410-961f-82ee72b054a4
2017-06-23 PR c++/79056 - C++17 ICE with invalid template syntax.jason
* parser.c (cp_parser_simple_type_specifier): Don't assume that type is a TYPE_DECL. (cp_parser_check_for_invalid_template_id): Handle TYPE_DECL. * pt.c (template_placeholder_p): New. * cp-tree.h: Declare it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@249615 138bc75d-0d04-0410-961f-82ee72b054a4
2017-06-17 Fix array decay handling in constant expressions.jason
* parser.c (cp_parser_constant_expression): Check potential_rvalue_constant_expression after decay_conversion. * pt.c (convert_nontype_argument): Don't require linkage in C++17. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@249325 138bc75d-0d04-0410-961f-82ee72b054a4
2017-06-05 * parser.c (cp_parser_base_specifier): Fix typos in error messages.reichelt
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@248886 138bc75d-0d04-0410-961f-82ee72b054a4
2017-04-18 PR c++/80241 - ICE with alignas pack expansion.mpolacek
* error.c (dump_expr): Handle TREE_LIST. * parser.c (cp_parser_std_attribute_list): Return error_mark if make_pack_expansion returns an error. * g++.dg/cpp0x/alignas11.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246963 138bc75d-0d04-0410-961f-82ee72b054a4
2017-04-03Fix numerous typos in commentsredi
gcc: * alias.c (base_alias_check): Fix typo in comment. * cgraph.h (class ipa_polymorphic_call_context): Likewise. * cgraphunit.c (symbol_table::compile): Likewise. * collect2.c (maybe_run_lto_and_relink): Likewise. * config/arm/arm.c (arm_thumb1_mi_thunk): Likewise. * config/avr/avr-arch.h (avr_arch_info_t): Likewise. * config/avr/avr.c (avr_map_op_t): Likewise. * config/cr16/cr16.h (DATA_ALIGNMENT): Likewise. * config/epiphany/epiphany.c (TARGET_ARG_PARTIAL_BYTES): Likewise. * config/epiphany/epiphany.md (movcc): Likewise. * config/i386/i386.c (legitimize_pe_coff_extern_decl): Likewise. * config/m68k/m68k.c (struct _sched_ib, m68k_sched_variable_issue): Likewise. * config/mips/mips.c (mips_save_restore_reg): Likewise. * config/rx/rx.c (rx_is_restricted_memory_address): Likewise. * config/s390/s390.c (Z10_EARLYLOAD_DISTANCE): Likewise. * config/sh/sh.c (sh_rtx_costs): Likewise. * fold-const.c (fold_truth_andor): Likewise. * genautomata.c (collapse_flag): Likewise. * gengtype.h (struct type::u::s): Likewise. * gensupport.c (has_subst_attribute, add_mnemonic_string): Likewise. * input.c (FORMAT_AMOUNT): Likewise. * ipa-cp.c (class ipcp_lattice, agg_replacements_to_vector) (known_aggs_to_agg_replacement_list): Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline.h (estimate_edge_time, estimate_edge_hints): Likewise. * ipa-polymorphic-call.c (ipa_polymorphic_call_context::restrict_to_inner_class): Likewise. * loop-unroll.c (analyze_insn_to_expand_var): Likewise. * lra.c (lra_optional_reload_pseudos, lra_subreg_reload_pseudos): Likewise. * modulo-sched.c (apply_reg_moves): Likewise. * omp-expand.c (build_omp_regions_1): Likewise. * trans-mem.c (struct tm_wrapper_hasher): Likewise. * tree-ssa-loop-ivopts.c (may_eliminate_iv): Likewise. * tree-ssa-loop-niter.c (maybe_lower_iteration_bound): Likewise. * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Likewise. * value-prof.c: Likewise. * var-tracking.c (val_reset): Likewise. gcc/ada: * doc/gnat_ugn/gnat_and_program_execution.rst: Fix typo. * g-socket.adb (To_Host_Entry): Fix typo in comment. * gnat_ugn.texi: Fix typo. * raise.c (_gnat_builtin_longjmp): Fix capitalization in comment. * s-stposu.adb (Allocate_Any_Controlled): Fix typo in comment. * sem_ch3.adb (Build_Derived_Record_Type): Likewise. * sem_util.adb (Mark_Coextensions): Likewise. * sem_util.ads (Available_Full_View_Of_Component): Likewise. gcc/c: * c-array-notation.c: Fix typo in comment. gcc/c-family: * c-warn.c (do_warn_double_promotion): Fix typo in comment. gcc/cp: * class.c (update_vtable_entry_for_fn): Fix typo in comment. * decl2.c (one_static_initialization_or_destruction): Likewise. * name-lookup.c (store_bindings): Likewise. * parser.c (make_call_declarator): Likewise. * pt.c (check_explicit_specialization): Likewise. gcc/testsuite: * g++.old-deja/g++.benjamin/scope02.C: Fix typo in comment. * gcc.dg/20031012-1.c: Likewise. * gcc.dg/ipa/ipcp-1.c: Likewise. * gcc.dg/torture/matrix-3.c: Likewise. * gcc.target/powerpc/ppc-spe.c: Likewise. * gcc.target/rx/zero-width-bitfield.c: Likewise. libcpp: * include/line-map.h (LINEMAPS_MACRO_MAPS): Fix typo in comment. * lex.c (search_line_fast): Likewise. * pch.h (cpp_valid_state): Likewise. libdecnumber: * decCommon.c (decFloatFromPackedChecked): Fix typo in comment. * decNumber.c (decNumberPower, decMultiplyOp): Likewise. libgcc: * config/c6x/pr-support.c (__gnu_unwind_execute): Fix typo in comment. libitm: * libitm_i.h (sutrct gtm_thread): Fix typo in comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246664 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-31 PR libstdc++/80251jakub
c-family/ * c-common.h (enum rid): Add RID_IS_AGGREGATE. * c-common.c (c_common_reswords): Add __is_aggregate trait. cp/ * cp-tree.h (enum cp_trait_kind): Add CPTK_IS_AGGREGATE. * cxx-pretty-print.c (pp_cxx_trait_expression): Handle CPTK_IS_AGGREGATE. * semantics.c (trait_expr_value): Handle CPTK_IS_AGGREGATE. Remove extraneous parens. (finish_trait_expr): Handle CPTK_IS_AGGREGATE. * parser.c (cp_parser_primary_expression): Handle RID_IS_AGGREGATE. (cp_parser_trait_expr): Likewise. testsuite/ * g++.dg/ext/is_aggregate.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246609 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-07 PR c/79834jakub
c/ * c-parser.c (c_parser_pragma): Use error_at instead of c_parser_error for "may only be used in compound statements" diagnostics, change it such that the same translatable string is used for all pragmas. For PRAGMA_OACC_WAIT use "acc wait" rather than "acc enter data" in the diagnostics. (c_parser_omp_cancellation_point, c_parser_omp_target_update, c_parser_omp_target_enter_data, c_parser_omp_target_exit_data): Change "may only be used in compound statements" diagnostics, such that the same translatable string is used for all pragmas. cp/ * parser.c (cp_parser_omp_cancellation_point, cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data, cp_parser_omp_target_update): Change "may only be used in compound statements" diagnostics, such that the same translatable string is used for all pragmas. (cp_parser_pragma): Likewise. Use error_at instead of cp_parser_error for that diagnostics. testsuite/ * c-c++-common/goacc/pragma_context.c (f2): Adjust expected diagnostics. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245959 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-06 Revert "Allow deduction guides to look into primary template."jason
* cp-tree.h, parser.c, pt.c, search.c: Revert. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245924 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-03 Allow deduction guides to look into primary template.jason
* cp-tree.h (struct saved_scope): Add deduction_guide_type. (struct cp_decl_specifier_seq): Add constructor_p. * parser.c (cp_parser_decl_specifier_seq): Set constructor_p. (cp_parser_init_declarator): Check it. Set ctor_dtor_or_conv_p. Clear deduction_guide_type. Don't handle deduction guide names. (cp_parser_declarator): Don't clear ctor_dtor_or_conv_p. (cp_parser_direct_declarator): Likewise. Handle deduction guides. (cp_parser_member_declaration, cp_parser_cache_defarg) (cp_parser_objc_class_ivars): Set ctor_dtor_or_conv_p. * pt.c (tsubst_copy, tsubst_copy_and_build): Revert last change. (build_deduction_guide): Set deduction_guide_type. (dependent_scope_p): Check deduction_guide_type. * search.c (lookup_member): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245858 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-02 Class template argument deduction in new-expressionjason
* init.c (build_new): Handle deduction from no initializer. * parser.c (cp_parser_new_expression): Don't require a single expression for class template deduction. * typeck2.c (cxx_incomplete_type_diagnostic): Fix diagnostic for class template placeholder. * pt.c (tsubst_copy) [TEMPLATE_DECL]: Handle dependent context. (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle SCOPE_REF. (redeclare_class_template): Set TEMPLATE_TYPE_PARM_FOR_CLASS. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245826 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-28 * config/i386/i386.c: Include intl.h.jakub
(ix86_option_override_internal): Use cond ? G_("...") : G_("...") instead of just cond ? "..." : "...". * config/nvptx/nvptx.c (nvptx_goacc_validate_dims): Likewise. * coverage.c (read_counts_file): Likewise. * omp-offload.c: Include intl.h. (oacc_loop_fixed_partitions): Use cond ? G_("...") : G_("...") instead of just cond ? "..." : "...". * gcov.c (read_count_file): Use cond ? N_("...") : N_("...") instead of just cond ? "..." : "...". c/ * c-parser.c (c_parser_asm_statement): Use cond ? G_("...") : G_("...") instead of just cond ? "..." : "...". (c_parser_oacc_enter_exit_data): Use %s and ternary operator only for "enter"/"exit" keyword. (c_finish_oacc_routine): Don't use %s to supply portions of the message. cp/ * decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...") instead of just cond ? "..." : "...". (grokdeclarator): Likewise. (build_enumerator): Likewise. * init.c (build_new_1): Likewise. * call.c (build_new_method_call_1): Likewise. * parser.c: Include intl.h. (cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for "enter"/"exit" keyword. (cp_finalize_oacc_routine): Don't use %s to supply portions of the message. fortran/ * parse.c (parse_critical_block): Use cond ? G_("...") : G_("...") instead of just cond ? "..." : "...". * scanner.c (gfc_next_char_literal): Likewise. * match.c (match_exit_cycle): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245778 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-24 PR c++/79588jakub
c-family/ * c-common.c (check_function_restrict): New function. (check_function_arguments): Add FNDECL argument. Call check_function_restrict if -Wrestrict. * c-warn.c (warn_for_restrict): Remove ARGS argument, add ARGARRAY and NARGS. Use auto_vec for ARG_POSITIONS, simplify. * c-common.h (check_function_arguments): Add FNDECL argument. (warn_for_restrict): Remove ARGS argument, add ARGARRAY and NARGS. c/ * c-parser.c (c_parser_postfix_expression_after_primary): Don't handle -Wrestrict here. * c-typeck.c (build_function_call_vec): Adjust check_function_arguments caller. cp/ * call.c (build_over_call): Call check_function_arguments even for -Wrestrict, adjust check_function_arguments caller. * parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict here. * typeck.c (cp_build_function_call_vec): Adjust check_function_arguments caller. testsuite/ * g++.dg/warn/Wrestrict-1.C: New test. * g++.dg/warn/Wrestrict-2.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245719 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-22 PR c++/79664jakub
* parser.c (cp_parser_omp_teams, cp_parser_omp_target): Use SET_EXPR_LOCATION on OMP_TARGET/OMP_TEAMS tree. * constexpr.c (potential_constant_expression_1): Handle OMP_*, OACC_* and CILK_* trees. Use error_at with EXPR_LOC_OR_LOC (t, input_location) computed early instead of error, or error_at with location_of (t). * g++.dg/gomp/teams-1.C: Adjust expected diagnostic location. * g++.dg/cpp1y/constexpr-throw.C: Likewise. * g++.dg/gomp/pr79664.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245662 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-22 PR c++/79653mpolacek
* parser.c (cp_parser_std_attribute_spec): Don't build the attribute if the alignas expression is erroneous. * pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return error_mark_node. * g++.dg/cpp0x/alignas10.C: New test. * g++.dg/cpp0x/alignas9.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245657 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-21 PR c++/79535mpolacek
* cp-tree.h (maybe_reject_flexarray_init): Declare. * init.c (maybe_reject_flexarray_init): No longer static. Add check for current_function_decl. * parser.c (cp_parser_late_parse_one_default_arg): Reject a default mem-initializer for a flexible array. * g++.dg/ext/flexary23.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245641 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-20 PR c++/79566 - elaborated-type-specifier in range forjason
* parser.c (cp_parser_simple_declaration): Fix check for type definition. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245591 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-20 PR c++/79400 - confusing suggestion of 'noexcept'jason
* parser.c (cp_parser_exception_specification_opt): Remove suggestion for deprecated dynamic exception-specification. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245590 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-20 PR c++/79580 - ICE with compound literaljason
* parser.c (cp_parser_class_head): If we're in the middle of an expression, use ts_within_enclosing_non_class. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245587 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-19PR c++/69523 make -Wliteral-suffix control warningredi
gcc: PR c++/69523 * doc/invoke.texi (C++ Dialect Options) [-Wliteral-suffix]: Update description. gcc/cp: 2017-02-19 Eric Fiselier <eric@efcs.ca> Jonathan Wakely <jwakely@redhat.com> PR c++/69523 * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to control warning about literal suffix identifiers without a leading underscore. gcc/testsuite: 2017-02-19 Eric Fiselier <eric@efcs.ca> Jonathan Wakely <jwakely@redhat.com> PR c++/69523 * g++.dg/cpp0x/Wliteral-suffix2.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245574 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-17 PR c++/79508 - lookup error with member templatejason
* parser.c (cp_parser_template_name): Clear parser->context->object_type if we aren't doing lookup. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245553 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-16 PR c++/79512jakub
c/ * c-parser.c (c_parser_omp_target): For -fopenmp-simd ignore #pragma omp target even when not followed by identifier. cp/ * parser.c (cp_parser_omp_target): For -fopenmp-simd ignore #pragma omp target even when not followed by identifier. testsuite/ * c-c++-common/gomp/pr79512.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245504 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-15 PR c++/79301jakub
* parser.c (cp_parser_std_attribute): Don't pedwarn about [[deprecated]] with -std=c++11 and [[fallthrough]] with -std=c++11 and -std=c++14. * g++.dg/cpp1y/feat-cxx11-neg.C: Remove (with pedwarn) from [[deprecated]] comment. * g++.dg/cpp1y/feat-cxx98-neg.C: Likewise. * g++.dg/cpp1y/feat-cxx11.C: Likewise. * g++.dg/cpp1y/attr-deprecated-neg.C: Don't expect warnings for [[deprecated]] in -std=c++11. * g++.dg/cpp0x/fallthrough2.C: Don't expect warnings for [[fallthrough]] in -std=c++11 and -std=c++14. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245489 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-14 PR c++/79420mpolacek
PR c++/79463 * parser.c (cp_parser_postfix_dot_deref_expression): Avoid clobbering if the postfix expression isn't an EXPR_P. * g++.dg/cpp1y/pr79463.C: New. * g++.dg/template/incomplete10.C: New. * g++.dg/template/incomplete9.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245440 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-13 * init.c (warn_placement_new_too_small): Add missing space injakub
diagnostics. * parser.c (cp_parser_oacc_declare): Likewise. * mangle.c (maybe_check_abi_tags): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245407 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-09 PR c++/79316 - default argument in deduction guidejason
PR c++/79350 - explicit deduction guide * parser.c (cp_parser_constructor_declarator_p) (cp_parser_direct_declarator): Parse deduction guides more like constructors. * cp-tree.h (enum special_function_kind): Add sfk_deduction_guide. * tree.c (special_function_p): Return it. * decl.c (check_special_function_return_type): Handle it. (grokdeclarator, grokfndecl): Adjust. (cp_finish_decl): Pass flags to do_auto_deduction. * error.c (dump_decl_name): Use TFF_UNQUALIFIED_NAME. * pt.c (dguide_name_p): Take a const_tree. (do_class_deduction): Handle explicit. (do_auto_deduction): Pass flags through. (build_deduction_guide): Copy explicit flag. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245314 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-09 PR c++/79429jakub
* parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt non-pragma_compound context here. (cp_parser_omp_target): Likewise. (cp_parser_pragma): Don't call push_omp_privatization_clauses and parsing for ordered and target omp pragmas in non-pragma_stmt non-pragma_compound contexts. * c-c++-common/gomp/pr79429.c: New test. * g++.dg/gomp/pr79429.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245303 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-09 PR c/79431jakub
* gimplify.c (gimplify_adjust_omp_clauses): Ignore "omp declare target link" attribute unless is_global_var. * omp-offload.c (find_link_var_op): Likewise. c/ * c-parser.c (c_parser_omp_declare_target): Don't invoke symtab_node::get on automatic variables. cp/ * parser.c (cp_parser_oacc_declare): Formatting fix. (cp_parser_omp_declare_target): Don't invoke symtab_node::get on automatic variables. testsuite/ * c-c++-common/gomp/pr79431.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245302 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-092017-02-09 Nathan Sidwell <nathan@codesourcery.com>cltang
Cesar Philippidis <cesar@codesourcery.com> Joseph Myers <joseph@codesourcery.com> Chung-Lin Tang <cltang@codesourcery.com> gcc/ * gimplify.c (gimplify_scan_omp_clauses): No special handling for OMP_CLAUSE_TILE. (gimplify_adjust_omp_clauses): Don't delete TILE. (gimplify_omp_for): Deal with TILE. * internal-fn.c (expand_GOACC_TILE): New function. * internal-fn.def (GOACC_DIM_POS): Comment may be overly conservative. (GOACC_TILE): New. * omp-expand.c (struct oacc_collapse): Add tile and outer fields. (expand_oacc_collapse_init): Add LOC paramter. Initialize tile element fields. (expand_oacc_collapse_vars): Add INNER parm, adjust for tiling, avoid DIV for outermost collapse var. (expand_oacc_for): Insert tile element loop as needed. Adjust. Remove out of date comments, fix whitespace. * omp-general.c (omp_extract_for_data): Deal with tiling. * omp-general.h (enum oacc_loop_flags): Add OLF_TILE flag, adjust OLF_DIM_BASE value. (struct omp_for_data): Add tiling field. * omp-low.c (scan_sharing_clauses): Allow OMP_CLAUSE_TILE. (lower_oacc_head_mark): Add OLF_TILE as appropriate. Ensure 2 levels for auto loops. Remove default auto determining, moved to oacc_loop_fixed_partitions. * omp-offload.c (struct oacc_loop): Change 'ifns' to vector of call stmts, add e_mask field. (oacc_dim_call): New function, abstracted out from oacc_thread_numbers. (oacc_thread_numbers): Use oacc_dim_call. (oacc_xform_tile): New. (new_oacc_loop_raw): Initialize e_mask, adjust for ifns vector. (finish_oacc_loop): Adjust for ifns vector. (oacc_loop_discover_walk): Append loop abstraction sites to list, add case for GOACC_TILE fns. (oacc_loop_xform_loop): Delete. (oacc_loop_process): Iterate over call list directly, and add handling for GOACC_TILE fns. (oacc_loop_fixed_partitions): Determine default auto, deal with TILE, dump partitioning. (oacc_loop_auto_partitions): Add outer_assign parm. Assign all but vector partitioning to outer loops. Assign 2 partitions to loops when available. Add TILE handling. (oacc_loop_partition): Adjust oacc_loop_auto_partitions call. (execite_oacc_device_lower): Process GOACC_TILE fns, ignore unknown specs. * tree-nested.c (convert_nonlocal_omp_clauses): Allow OMP_CLAUSE_TILE. * tree.c (omp_clause_num_ops): Adjust TILE ops. * tree.h (OMP_CLAUSE_TILE_ITERVAR, OMP_CLAUSE_TILE_COUNT): New. gcc/c/ * c-parser.c (c_parser_omp_clause_collapse): Disallow tile. (c_parser_oacc_clause_tile): Disallow collapse. Fix parsing and semantic checking. * c-parser.c (c_parser_omp_for_loop): Accept tiling constructs. gcc/cp/ * parser.c (cp_parser_oacc_clause_tile): Disallow collapse. Fix parsing. Parse constant expression. Remove semantic checking. (cp_parser_omp_clause_collapse): Disallow tile. (cp_parser_omp_for_loop): Deal with tile clause. Don't emit a parse error about missing for after already emitting one. Use more conventional for idiom for unbounded loop. * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE. * semantics.c (finish_omp_clauses): Correct TILE semantic check. (finish_omp_for): Deal with tile clause. gcc/fortran/ * openmp.c (resolve_omp_clauses): Error on directives containing both tile and collapse clauses. (resolve_oacc_loop_blocks): Represent '*' tile arguments as zero. * trans-openmp.c (gfc_trans_omp_do): Lower tiled loops like collapsed loops. gcc/testsuite/ * c-c++-common/goacc/combined-directives.c: Remove xfail. * c-c++-common/goacc/loop-auto-1.c: Adjust and add additional case. * c-c++-common/goacc/loop-auto-2.c: New. * c-c++-common/goacc/tile.c: Include stdbool, fix expected errors. * c-c++-common/goacc/tile-2.c: New. * g++.dg/goacc/template.C: Test tile subst. Adjust erroneous uses. * g++.dg/goacc/tile-1.C: New, check tile subst. * gcc.dg/goacc/loop-processing-1.c: Adjust dg-final pattern. * gfortran.dg/goacc/combined-directives.f90: Remove xfail. * gfortran.dg/goacc/tile-1.f90: New test. * gfortran.dg/goacc/tile-2.f90: New test. * gfortran.dg/goacc/tile-lowering.f95: New test. libgomp/ * testsuite/libgomp.oacc-c-c++-common/tile-1.c: New. * testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c: Adjust and add additional case. * testsuite/libgomp.oacc-c-c++-common/vprop.c: XFAIL under "openacc_nvidia_accel_selected". * libgomp.oacc-fortran/nested-function-1.f90 (test2): Add num_workers(8) clause. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245300 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-06 PR c++/71193 - incomplete types in templatesjason
* parser.c (cp_parser_postfix_dot_deref_expression): In a template handle incomplete type by pedwarning and then treating as dependent. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245223 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-31Introduce C++ support in libcc1aoliva
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245051 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-27Fix PR c++/64382abutcher
PR c++/64382 * cp/parser.c (parsing_default_capturing_generic_lambda_in_template): New function. * cp/cp-tree.h: Declare it. * cp/semantics.c (finish_id_expression): Resolve names within a default capturing generic lambda defined within a template prior to instantiation to allow for captures to be added to the closure type. PR c++/64382 * g++.dg/cpp1y/pr64382.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244962 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-26 PR c++/68727jakub
* cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2. * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument. * parser.c (cp_parser_builtin_offsetof): Pass result of build_static_cast of null_pointer_node to finish_offsetof. * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use it for -Winvalid-offsetof pedwarn instead of trying to guess original offsetof type from EXPR. Save OBJECT_PTR as a new second operand to OFFSETOF_EXPR. * pt.c (tsubst_copy_and_build) <case OFFSETOF_EXPR>: Adjust finish_offsetof caller, pass the second operand of OFFSETOF_EXPR as OBJECT_PTR. * g++.dg/other/offsetof8.C: Add expected error. * g++.dg/other/offsetof9.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244949 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-25 PR c++/77914jakub
* parser.c (cp_parser_lambda_declarator_opt): Pedwarn with OPT_Wpedantic on lambda templates for -std=c++14 and higher. * g++.dg/cpp1y/lambda-generic-77914.C: New test. * g++.dg/cpp1y/lambda-generic-dep.C: Add -pedantic to dg-options, expect a warning. * g++.dg/cpp1y/lambda-generic-x.C: Add -Wpedantic to dg-options, expect warnings. * g++.dg/cpp1y/lambda-generic-mixed.C: Add empty dg-options. * g++.dg/cpp1y/pr59636.C: Likewise. * g++.dg/cpp1y/pr60190.C: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244907 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-20C++: fix fix-it hints for misspellings within explicit namespacesdmalcolm
gcc/cp/ChangeLog: PR c++/77829 PR c++/78656 * cp-tree.h (suggest_alternatives_for): Add bool param. (suggest_alternative_in_explicit_scope): New decl. * error.c (qualified_name_lookup_error): When SCOPE is a namespace that isn't the global one, call new function suggest_alternative_in_explicit_scope, only calling suggest_alternatives_for if it fails, and disabling near match searches fort that case. When SCOPE is the global namespace, pass true for new param to suggest_alternatives_for to allow for fuzzy name lookups. * lex.c (unqualified_name_lookup_error): Pass true for new param to suggest_alternatives_for. * name-lookup.c (consider_binding_level): Add forward decl. (suggest_alternatives_for): Add "suggest_misspellings" param, using it to conditionalize the fuzzy name-lookup code. (suggest_alternative_in_explicit_scope): New function. * parser.c (cp_parser_primary_expression): When calling finish_id_expression, pass location of id_expression rather than that of id_expr_token. (cp_parser_id_expression): Convert local "unqualified_id" from tree to cp_expr to avoid implicitly dropping location information. gcc/testsuite/ChangeLog: PR c++/77829 PR c++/78656 * g++.dg/spellcheck-pr77829.C: New test case. * g++.dg/spellcheck-pr78656.C: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244715 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-19 PR c++/79130 - decomposition and direct-initializationjason
* init.c (build_aggr_init): Communicate direct-initialization to build_vec_init. (build_vec_init): Check for array copy sooner. * parser.c (cp_parser_decomposition_declaration): Remove call to build_x_compound_expr_from_list. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244635 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-17 PR c++/61636nathan
* cp-tree.h (maybe_generic_this_capture): Declare. * lambda.c (resolvable_dummy_lambda): New, broken out of ... (maybe_resolve_dummy): ... here. Call it. (maybe_generic_this_capture): New. * parser.c (cp_parser_postfix_expression): Speculatively capture this in generic lambda in unresolved member function call. * pt.c (tsubst_copy_and_build): Force hard error from failed member function lookup in generic lambda. PR c++/61636 * g++.dg/cpp1y/pr61636-1.C: New. * g++.dg/cpp1y/pr61636-2.C: New. * g++.dg/cpp1y/pr61636-3.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244544 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-11 PR c++/78341jakub
* parser.c (cp_parser_std_attribute_spec): Remove over-eager assertion. Formatting fix. * g++.dg/cpp0x/pr78341.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244329 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-10Fix issues with unrepresentable column numbers (PR c++/77949)dmalcolm
PR c++/77949 identifies an ICE when the C++ frontend attempts to emit a fix-it hint inserting a missing semicolon at column 4097 of a source file. This column value exceeds LINE_MAP_MAX_COLUMN_NUMBER and hence isn't representable using a location_t. Attempting to do so leads to these problems, which this patch fixes: (a) when encountering a column number > LINE_MAP_MAX_COLUMN_NUMBER we create a new linemap with m_column_and_range_bits == 0, but linemap_position_for_column doesn't check for this, and hence can emit a bogus location_t value that's calculated relative to the previous linemap start, but which will be decoded relative to the new linemap, leading to very large incorrect line values. (b) when encountering a column number that can't be represented, and for which the linemap was pre-existing, the code would hit this assertion: if (linemap_assert_fails (column < (1u << map->m_column_and_range_bits))) around a bail-out condition. The patch replaces this assertion with a simple conditional, to stop the ICE when this occurs, and fixes the bit count (effective column bits, vs column+range bits) (c) the C++ frontend wasn't checking for failure of linemap_position_for_loc_and_offset when considering emitting the fix-it hint. The patch adds a conditional, so that no fix-it hint is emitted if the location is bogus. gcc/cp/ChangeLog: PR c++/77949 * parser.c (cp_parser_class_specifier_1): Only suggest inserting a missing semicolon if we have a valid insertion location for the fix-it hint. gcc/ChangeLog: PR c++/77949 * input.c (selftest::test_accessing_ordinary_linemaps): Verify that we correctly handle column numbers greater than LINE_MAP_MAX_COLUMN_NUMBER. gcc/testsuite/ChangeLog: PR c++/77949 * g++.dg/diagnostic/pr77949.C: New test case. libcpp/ChangeLog: PR c++/77949 * line-map.c (linemap_position_for_column): When calling linemap_start_line, detect if a new linemap was created with 0 column bits, and bail out early if this is the case. (linemap_position_for_loc_and_offset): Replace overzealous linemap_assert_fails with a simple conditional; use correct bit count. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244292 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-10 FI 20, decomposition declaration with parenthesized initializer.jason
* parser.c (cp_parser_decomposition_declaration): Use cp_parser_initializer. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244282 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-09 Implement P0195R2, C++17 variadic using.jason
* parser.c (cp_parser_using_declaration): Handle ellipsis and comma. * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE. * error.c (dump_decl): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244246 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-08 PR c++/78948 - instantiation from discarded statementjason
* parser.h (struct cp_parser): Remove in_discarded_stmt field. * cp-tree.h (in_discarded_stmt): Declare it. (struct saved_scope): Add discarded_stmt bitfield. (in_discarded_stmt): New macro. * decl2.c (mark_used): Check it. * parser.c (cp_parser_selection_statement): Adjust. (cp_parser_jump_statement): Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244206 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-04 PR c++/78693jakub
* parser.c (cp_parser_simple_declaration): Only complain about inconsistent auto deduction if auto_result doesn't use auto. * g++.dg/cpp0x/pr78693.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244074 138bc75d-0d04-0410-961f-82ee72b054a4