Commit Graph

2449 Commits

Author SHA1 Message Date
Jason Merrill b7beb16ac1 C++17 class deduction issues
PR c++/77890
	PR c++/77912
	* pt.c (do_class_deduction): Set cp_unevaluated_operand.
	(tsubst) [TEMPLATE_TYPE_PARM]: Copy CLASS_PLACEHOLDER_TEMPLATE.

From-SVN: r240948
2016-10-10 16:48:51 -04:00
Jakub Jelinek be845b04a8 Implement LWG2296 helper intrinsic c-family/
Implement LWG2296 helper intrinsic
c-family/
	* c-common.h (enum rid): Add RID_ADDRESSOF.
	* c-common.c (c_common_reswords): Add __builtin_addressof.
cp/
	* parser.c (cp_parser_postfix_expression): Handle RID_ADDRESSOF.
	* cp-objcp-common.c (cp_common_init_ts): Handle ADDRESSOF_EXPR.
	* constexpr.c (potential_constant_expression_1): Likewise.
	* error.c (dump_expr): Likewise.
	* typeck.c (cp_build_addressof): New function.
	* cp-tree.h (cp_build_addressof): Declare.
	* cxx-pretty-print.h (pp_cxx_addressof_expression): Declare.
	* cp-tree.def (ADDRESSOF_EXPR): New tree code.
	* cxx-pretty-print.c (cxx_pretty_printer::primary_expression): Handle
	ADDRESSOF_EXPR.  Add __builtin_addressof and
	__has_unique_object_representations into syntax in function comment.
	(pp_cxx_addressof_expression): New function.
	* pt.c (tsubst_copy_and_build): Handle ADDRESSOF_EXPR.
testsuite/
	* g++.dg/cpp0x/addressof1.C: New test.
	* g++.dg/cpp0x/addressof2.C: New test.

From-SVN: r240873
2016-10-07 21:37:46 +02:00
Marek Polacek 17a9e3802a Implement P0305R1, Selection statements with initializer.
* cp-array-notation.c (create_an_loop): Call finish_init_stmt
	instead of finish_for_init_stmt.
	* cp-tree.h (finish_for_init_stmt): Rename to finish_init_stmt.
	* decl.c (poplevel): Adjust a comment.
	* init.c (build_vec_init): Call finish_init_stmt instead of
	finish_for_init_stmt.
	* name-lookup.c (pushdecl_maybe_friend_1): Adjust a comment.
	* name-lookup.h (enum scope_kind): Likewise.
	* parser.c (cp_parser_statement): Update commentary.
	(cp_parser_init_statement_p): New function.
	(cp_parser_selection_statement): Parse the optional init-statement.
	(cp_parser_for): Call finish_init_stmt instead of finish_for_init_stmt.
	(cp_parser_c_for): Likewise.
	(cp_convert_range_for): Call finish_init_stmt instead of finish_for_init_stmt.
	(cp_parser_range_for_member_function): Update commentary.
	(cp_parser_iteration_statement):
	(cp_parser_for_init_statement): Rename to cp_parser_init_statement.
	* pt.c (tsubst_omp_for_iterator): Update commentary.
	(tsubst_expr): Call finish_init_stmt instead of finish_for_init_stmt.
	* semantics.c (finish_for_init_stmt): Rename to finish_init_stmt.
	Update commentary.

	* g++.dg/cpp1z/init-statement1.C: New test.
	* g++.dg/cpp1z/init-statement2.C: New test.
	* g++.dg/cpp1z/init-statement3.C: New test.
	* g++.dg/cpp1z/init-statement4.C: New test.
	* g++.dg/cpp1z/init-statement5.C: New test.
	* g++.dg/cpp1z/init-statement6.C: New test.
	* g++.dg/cpp1z/init-statement7.C: New test.
	* g++.dg/cpp1z/init-statement8.C: New test.

From-SVN: r240798
2016-10-05 18:02:06 +00:00
Jason Merrill f1644724b5 PR c++/77852 - class deduction from list-init
* pt.c (do_class_deduction): Handle list-initialization.
	(do_auto_deduction): Call it sooner.
	(build_deduction_guide): Use tsubst_arg_types.
	(rewrite_template_parm): Don't copy_type.

From-SVN: r240765
2016-10-04 21:24:38 -04:00
Jason Merrill 76b294d48d Implement P0091R2, Template argument deduction for class templates.
* parser.c (cp_parser_simple_type_specifier): Parse class placeholder.
Use the location of the beginning of the type-specifier.
(cp_parser_init_declarator): Parse deduction guide.
(cp_parser_diagnose_invalid_type_name): Mention class deduction.
(cp_parser_type_id_1): Don't accept class placeholder as template arg.
* cp-tree.h (CLASS_PLACEHOLDER_TEMPLATE): New.
* decl.c (grokdeclarator): Check for uninitialized auto here.
(start_decl_1): Not here.
(cp_finish_decl): Or here.  Don't collapse a list when doing
class deduction.
(grokfndecl): Check deduction guide scope and body.
* error.c (dump_decl, dump_function_decl, dump_function_name):
Handle deduction guides.
* pt.c (make_template_placeholder, do_class_deduction): New.
(build_deduction_guide, rewrite_template_parm): New.
(dguide_name, dguide_name_p, deduction_guide_p): New.
(do_auto_deduction): Call do_class_deduction.
(splice_late_return_type, is_auto): Handle class placeholders.
(template_parms_level_to_args): Split from template_parms_to_args.
(tsubst_template_parms_level): Split from tsubst_template_parms.
* typeck2.c (build_functional_cast): Handle class placeholder.

From-SVN: r240756
2016-10-04 16:42:58 -04:00
Jakub Jelinek bfecd57cd4 extend.texi (Java Exceptions): Remove.
* 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-10-04 17:32:31 +02:00
Marek Polacek 81fea426da Implement -Wimplicit-fallthrough.
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r240485
2016-09-26 09:42:50 +00:00
Marek Polacek e51fbec3ff c-common.c (c_common_truthvalue_conversion): Use false instead of 0.
* c-common.c (c_common_truthvalue_conversion): Use false instead of 0.
	* c-common.h (build_unary_op): Change nonconvert parameter type to bool.
	* c-omp.c (c_finish_omp_atomic): Use false instead of 0.

	* c-array-notation.c (create_cmp_incr): Use false instead of 0.
	(fix_array_notation_expr): Likewise.
	* c-decl.c (finish_decl): Likewise.
	* c-parser.c (c_parser_postfix_expression_after_primary): Likewise.
	* c-typeck.c (array_to_pointer_conversion): Use true instead of 1.
	(function_to_pointer_conversion): Use false instead of 0.
	(convert_lvalue_to_rvalue): Likewise.
	(parser_build_unary_op): Likewise.
	(build_atomic_assign): Likewise.
	(build_unary_op): Change nonconvert parameter type to bool, use
	true/false instead of 1/0.
	(build_binary_op): Use true instead of 1.

	* cp-tree.h (cp_build_unary_op): Change nonconvert parameter type to
	bool.
	* decl2.c (one_static_initialization_or_destruction): Use true instead
	of 1.
	* init.c (build_vec_init): Use false instead of 0.
	* pt.c (tsubst_copy_and_build): Likewise.
	* semantics.c (simplify_loop_decl_cond): Likewise.
	* typeck.c (rationalize_conditional_expr): Likewise.
	(cp_build_binary_op): Use true instead of 1.
	(cp_build_unary_op): Change nonconvert parameter type to bool.  Use true
	instead of 1.
	(build_unary_op): Change nonconvert parameter type to bool.
	(unary_complex_lvalue): Use false instead of 0.

From-SVN: r240137
2016-09-14 15:05:00 +00:00
Jason Merrill 9729a5d524 PR c++/57728 - explicit instantiation and defaulted functions
* pt.c (do_type_instantiation): Don't mess with non-user-provided
	member functions.

From-SVN: r239782
2016-08-26 11:10:51 -04:00
Marek Polacek 191816a36b re PR c/7652 (-Wswitch-break : Warn if a switch case falls through)
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-08-12 10:30:47 +00:00
Jason Merrill 99f9d4b1b6 Implement C++17 constexpr if.
* cp-tree.h (IF_STMT_CONSTEXPR_P): New.
	* name-lookup.c (push_to_top_level, pop_from_top_level_1): Handle it.
	* parser.h (struct cp_parser): Add in_discarded_stmt field.
	* parser.c (cp_parser_selection_statement): Handle 'if constexpr'.
	(cp_parser_jump_statement): Avoid deducing from a discarded return.
	* pt.c (tsubst_expr): Only instantiate taken branch of constexpr if.
	* semantics.c (begin_if_stmt): Set the binding level this_entity.
	(finish_if_stmt_cond): Require the condition of a
	constexpr if to be constant.
	* decl.c (level_for_constexpr_if): New.
	(named_label_entry): Add in_constexpr_if field.
	(poplevel_named_label_1): Set it.
	(check_goto): Check it.
	(check_previous_goto_1): Check level_for_constexpr_if.

From-SVN: r239338
2016-08-10 17:58:23 -04:00
Jason Merrill f3365c1201 PR c++/68703 - bogus error with dependent vector length
gcc/c-family/
	* c-common.c (c_common_attribute_table): vector_size affects type
	identity.
gcc/cp/
	* decl2.c (any_dependent_type_attributes_p): New.
	* pt.c (dependent_type_p_r, type_dependent_expression_p): Check it.
	* semantics.c (finish_id_expression): Check it.
	* typeck.c (finish_class_member_access_expr): Check it.

From-SVN: r239309
2016-08-09 18:03:07 -04:00
Jason Merrill 98e5a19af5 Implement C++17 constexpr lambda.
gcc/c-family/
	* c-cppbuiltin.c (c_cpp_builtins): Update __cpp_constexpr for
	C++17 constexpr lambdas.
gcc/cp/
	* class.c (finalize_literal_type_property): Handle lambdas.
	* constexpr.c (is_valid_constexpr_fn): Likewise.  No longer static.
	(explain_invalid_constexpr_fn, cxx_eval_call_expression): Handle
	lambdas.
	(cxx_eval_constant_expression): Handle capture proxy.
	(var_in_constexpr_fn): Don't check for C++14.
	(var_in_maybe_constexpr_fn): New.
	(potential_constant_expression_1): Use it.  Check DECL_EXPR for
	declarations not allowed in constexpr function.
	* decl.c (make_rtl_for_nonlocal_decl): Use var_in_maybe_constexpr_fn.
	(finish_function): Set DECL_DECLARED_CONSTEXPR_P on lambda members.
	* lambda.c (begin_lambda_type): Set CLASSTYPE_LITERAL_P.
	(maybe_add_lambda_conv_op): Clear thunk CALL_EXPR location.
	(lambda_static_thunk_p): New.
	* parser.c (cp_keyword_starts_decl_specifier_p): Add RID_CONSTEXPR.
	(CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR): New enumerator.
	(cp_parser_decl_specifier_seq): Handle it.
	(cp_parser_lambda_declarator_opt): Use cp_parser_decl_specifier_seq.
	* pt.c (instantiate_class_template_1): Set CLASSTYPE_LITERAL_P.
	(tsubst_copy_and_build) [CALL_EXPR]: Propagate CALL_FROM_THUNK_P.
	* error.c (dump_function_decl): Check TFF_NO_TEMPLATE_BINDINGS.
	(dump_expr) [FUNCTION_DECL]: Pass it.

From-SVN: r239268
2016-08-09 00:33:58 -04:00
Nathan Sidwell 4228ca1962 re PR c++/68724 (ice in unify, at cp/pt.c:19902)
PR c++/68724
	* pt.c (unify): TRAIT_EXPR is an expr.

	PR c++/68724
	* g++.dg/cpp0x/pr68724.C: New.

From-SVN: r239167
2016-08-05 12:21:46 +00:00
Patrick Palka 08156df50a Fix ICE on invalid variable template instantiation (PR c++/72759)
gcc/cp/ChangeLog:

	PR c++/72759
	* pt.c (tsubst_qualified_id): Return error_mark_node if
	template_args is error_mark_node.

gcc/testsuite/ChangeLog:

	PR c++/72759
	* g++.dg/cpp1y/pr72759.C: New test.

From-SVN: r239147
2016-08-04 19:14:32 +00:00
Jason Merrill b9dc9ef63f PR c++/72415 - member template with fold-expression constraint
* pt.c (tsubst_pack_expansion): Pull a single pack expansion out
	of the TREE_VEC.

From-SVN: r239138
2016-08-04 12:06:22 -04:00
Jason Merrill 6a7b92036b Rename TYPE_ANONYMOUS_P to TYPE_UNNAMED_P.
* cp-tree.h (TYPE_UNNAMED_P): Rename from TYPE_ANONYMOUS_P.
	(TYPE_WAS_UNNAMED): Rename from TYPE_WAS_ANONYMOUS.
	* class.c, decl.c, decl2.c, error.c, lambda.c, mangle.c,
	name-lookup.c, parser.c, pt.c, semantics.c, tree.c: Adjust.

From-SVN: r239137
2016-08-04 12:06:17 -04:00
Jason Merrill 270430ff3e PR c++/71747 - ICE with self-referential partial spec
* pt.c (get_partial_spec_bindings): Replace tparms and spec_args
	parameters with spec_tmpl.  Call push_tinst_level.
	(most_specialized_partial_spec): Adjust.
	(more_specialized_partial_spec): Adjust.

From-SVN: r238785
2016-07-27 10:31:30 -04:00
Jason Merrill 47265942fa PR c++/71837 - pack expansion in init-capture
* lambda.c (add_capture): Leave a pack expansion in a TREE_LIST.
	(build_lambda_object): Call build_x_compound_expr_from_list.
	* pt.c (tsubst) [DECLTYPE_TYPE]: Likewise.

From-SVN: r238733
2016-07-25 15:16:16 -04:00
Jason Merrill fd8b207a76 PR c++/71833 - member template with two parameter packs
PR c++/54440
	* pt.c (coerce_template_parameter_pack): Fix logic for
	pack index.

From-SVN: r238731
2016-07-25 15:10:41 -04:00
Jason Merrill 8a61db89b2 PR c++/71515 - typename in partial specialization
* pt.c (resolve_typename_type): Try to avoid calling
	currently_open_class.

From-SVN: r238696
2016-07-24 19:40:05 -04:00
Jason Merrill 71b3723abb PR c++/70778 - member template template parameter
* pt.c (tsubst): Also substitute into the template of a
	BOUND_TEMPLATE_TEMPLATE_PARM.

From-SVN: r238686
2016-07-23 22:50:16 -04:00
Jason Merrill 6970223f93 PR c++/71738 - nested template friend
* pt.c (lookup_template_class_1): Handle getting template from tsubst.

From-SVN: r238685
2016-07-23 22:39:41 -04:00
Jason Merrill 76178f6767 PR c++/71748 - call to base destructor in template.
PR c++/52746
	* pt.c (tsubst_baselink): Call
	adjust_result_of_qualified_name_lookup for unqualified
	destructors.

From-SVN: r238681
2016-07-23 22:19:46 -04:00
Jason Merrill 44ed47547a PR c++/71630 - extern variable template
* pt.c (instantiate_decl): Fix pattern_defined for namespace scope
	variable templates.

From-SVN: r238622
2016-07-21 23:45:43 -04:00
Andrew Sutton f078dc7d26 Improving concepts performance and diagnostics.
PR c++/67565
	PR c++/67579
	PR c++/71843
gcc/
	* timevar.def (TV_CONSTRAINT_SAT, TV_CONSTRAINT_SUB): New time vars
	for constraint satisfaction and subsumption.
	* timevar.h (auto_timevar): New constructor that matches the push/pop
	pattern of usage in pt.c.
gcc/cp/
	* cp-tree.def (CHECK_CONSTR): New.
	* cp-tree.h (CHECK_CONSTR_CONCEPT): New.
	(CHECK_CONSTR_ARGS): New.
	* constraint.cc (make_predicate_constraint): Remove in favor of
	normalize_expression.
	(resolve_constraint_check): Actually return error_mark_node when
	resolution fails.
	(resolve_variable_concept_check): Perform coercion as if processing
	a template. Also return errors on resolution failure.
	(lift_*): Remove all of these functions. Don't unnecessarily inline
	concepts.
	(learn_*): Add facilities to memoize implications for subsumption
	during normalization.
	(expanding_concept): New.
	(expand_concept): New. Return the inlined and normalized definition
	of a concept when needed.
	(transform_*, xform_*): Rename to normalize_* to better reflect the
	responsibility of those functions.
	(normalize_template_id_expression): Check for non-boolean operands
	when possible. Generate check constraints instead of normal variable
	references.
	(normalize_call_expression): Report errors when resolution fails.
	(check_for_logical_overloads): Rewrite this check to more accurately
	report the error.
	(normalize_atom): Check for overloaded calls and invalid types before
	determining if the expression refers to a concept.
	(build_constraints): Don't cache normalized constraints or decmposed
	assumptions.
	(finish_shorthand_constraint): Return a normalized expression instead
	of a predicate constraint.
	(finish_template_introduction): Same.
	(placeholder_extract_concept_and_args): Rewrite this since we only
	ever get check constraints here.
	(equivalent_placeholder_constraints): Rewrite in terms of check
	constraints, and handle error_mark_nodes correctly.
	(tsubst_check_constraint, tsubst_expr_constr, tsubst_type_constr)
	(tsubst_implicit_conversion_constr)
	(tsubst_argument_deduction_constr, tsubst_exception_constr)
	(tsubst_parameterized_constraint, tsubst_constraint): New.
	(tsbust_conjunection): Replace with tsubst_logical_operator and
	actually generate the right kind of constraint.
	(tsubst_requirement_body): Reverse the order of substituted arguments
	so that they appear in the order written (helps diagnostics).
	(satisfy_check_constraint): New.
	(satisfy_conjunction): Simplify.
	(satisfy_disjunction): Same.
	(satisfy_constraint_1): Handle check constraints.
	(eval_constr): New (private) global state.
	(evaluating_constraints_sentinel): New. Manages eval_constr.
	(satisfy_constraint): Add timing variables.
	(satisfy_associated_constraints): Add hooks for memoization.
	(evaluate_function_concept): Build a check constraint instead of
	normalizing its definition.
	(evaluate_variable_concept): Same.
	(evaluate_constraint_expression): Normalize, but in the current
	declaration processing context.
	(evaluating_constraints_p): New.
	(elide_constraint_failure_p): Actually emit constraint_thresh errors.
	(diagnose_*): Remove artificial indentation. Add a new parameter to
	each that tracks the current (complete) constraint prior to any
	substitutions.
	(diagnose_expression): Removed.
	(diagnose_call_expression): Same.
	(diagnose_template_id): Same.
	(diagnose_template_id): New.
	(diagnose_logical_constraint): New.
	(diagnose_expression_constraint): Show the original expression.
	(diagnose_type_constraint): Show the original type.
	(diagnose_implicit_conversion_constraint): Be specific about
	failures, don't re-diagnose a known-to-be-failed substitutions,
	and manage elisions properly.
	(diagnose_argument_deduction_constraint): Same.
	(diagnose_exception_constraint): Same.
	(diagnose_parameterized_constraint): Same.
	(constraint_p): Allow EXPR_PACK_EXPANSION.
	* logic.cc (next_by_distance): Removed. No longer used.
	(any_p): Renamed from any_of.
	(term_entry, term_hasher): New.
	(term_list): Rewrite to include a hash table for quick lookup.
	Also, make less stateful.
	(proof_state): Extend to allow goals to be discharged once
	satisfied.
	(non_atomic_constraint_p): New.
	(any_non_atomic_constraints_p): New.
	(...rest...): Previous implementation completely replaced with an
	iterative algorithm that opportunistically prunes the search space
	before committing to using more memory.
	* parser.c: (cp_parser_type_parameter): Normalize constraints.
	(cp_parser_explicit_template_declaration): Same.
	* pt.c: (finish_template_variable): Be less redundant with this error
	message.
	(template_args_equal): No longer static.
	(tsubst_decl): Don't try to find specializations of variables that
	have already been instantiated.
	(build_non_dependent_expr): Avoid infinite recursion during concept
	expansion.
	(make_constrained_auto): Normalize constraints.
	(do_auto_deduction): When doing auto deduction from a
	partial-concept-id, be sure to include the explicit args checking
	the constraints.
	(constraint_sat_*): New. Memoize satisfied constraints.
	(concept_spec_*): New. Memoize expressions associated with a concept
	specialization.
	(constraint_memos, concept_memos): New.
	(lookup_constraint_satisfaction, memoize_constraint_satisfaction): New.
	(lookup_concept_satisfaction, memoize_concept_satisfaction): New.
	(get_concept_expansion, save_concept_expansion): New.
	(hash_subsumption_args): New.
	(comp_subsumption_args): New.
	(subsumption_*): New. Memoize parts of the subsumption relation.
	(lookup_subsumption_result, save_subsumption_result): New.
	(init_constraint_processing): Initialize memo tables.
	(get_constraints): Shortcut if !flag_concepts.
	* decl.c (grokfndecl): Normalize constraints.
	* error.c (dump_simple_decl): Print "concept" when appropriate.
	(dump_function_decl): Same.
	(dump_template_decl): Don't write requirements when we're not
	printing the header.
	(dump_expr): Handle fold expressions.
	* cxx-pretty-print.c (cxx_pretty_printer::expression): Handle
	fold expressions.
	(get_fold_operator): New.
	(pp_cxx_unary_left_fold_expression): New.
	(pp_cxx_unary_right_fold_expression): New.
	(pp_cxx_binary_fold_expression): New.
	(pp_cxx_check_constraint): New.
	(pp_cxx_*_constraint): Rewrite the grammar of internal constraints
	to make them easier to read when debugging.
	* search.c (accessible_p): Don't shortcut when evaluating constraints.
	* tree.c (cp_tree_equal): Handle CHECK_CONSTR.

Co-Authored-By: Jason Merrill <jason@redhat.com>

From-SVN: r238558
2016-07-21 02:05:24 -04:00
Jason Merrill 43694e8bbb PR c++/67164 - clean up dead code
* pt.c (iterative_hash_template_arg, template_args_equal): Don't
	handle ARGUMENT_PACK_SELECT.

From-SVN: r238507
2016-07-20 01:06:52 -04:00
Jakub Jelinek 7a7f16ca45 re PR c++/71826 (ICE on valid C++ code with ambiguous member lookup: tree check: expected baselink, have error_mark in tsubst_baselink, at cp/pt.c:13737)
PR c++/71826
	* pt.c (tsubst_baselink): Only set BASELINK_OPTYPE for BASELINK_P.

	* g++.dg/template/pr71826.C: New test.

From-SVN: r238441
2016-07-18 20:42:24 +02:00
Jason Merrill 1019d19180 PR c++/71513 - alignas on member enum in template
* pt.c (tsubst_attributes): Fix loop logic.

From-SVN: r238392
2016-07-15 14:38:40 -04:00
Jason Merrill aa30dfadf3 PR c++/71711 - mangle C++1z fold-expressions.
* operators.def: Add *_FOLD_EXPR.
	* cp-tree.h (FOLD_EXPR_P): Parenthesize.
	* mangle.c (write_expression): Handle fold-expressions.
	* pt.c (tsubst_unary_left_fold, tsubst_binary_left_fold)
	(tsubst_unary_right_fold, tsubst_binary_right_fold): Handle
	partial instantiation.

From-SVN: r238390
2016-07-15 14:38:23 -04:00
Jason Merrill 9ee2cecc2f PR c++/71718 - infinite recursion and alias template
* pt.c (push_tinst_level_loc): Set at_eof before fatal_error.

From-SVN: r238387
2016-07-15 14:37:56 -04:00
Jason Merrill 72b3e20335 Use lvalue_p instead of real_lvalue_p.
* cp-tree.h: Unpoison lvalue_p.
	* call.c, class.c, constexpr.c, cvt.c, init.c, lambda.c, pt.c,
	tree.c, typeck.c, typeck2.c: Use lvalue_p instead of
	real_lvalue_p.

From-SVN: r238183
2016-07-08 17:32:18 -04:00
Jason Merrill e547455bd6 Fix type_dependent_expression_p of member templates.
* pt.c (template_parm_outer_level, uses_outer_template_parms): New.
	(type_dependent_expression_p): Use uses_outer_template_parms.

From-SVN: r237654
2016-06-21 14:17:01 -04:00
Jason Merrill 4eb24e0109 P0145R2: Refining Expression Order for C++.
gcc/c-family/
	* c.opt (fargs-in-order): New.
	* c-opts.c (c_common_post_options): Adjust flag_args_in_order.
gcc/cp/
	* cp-tree.h (CALL_EXPR_OPERATOR_SYNTAX, CALL_EXPR_ORDERED_ARGS)
	(CALL_EXPR_REVERSE_ARGS): New.
	* call.c (build_new_op_1): Set them.
	(extract_call_expr, op_is_ordered): New.
	(build_over_call): Set CALL_EXPR_ORDERED_ARGS.
	* cp-gimplify.c (cp_gimplify_expr) [CALL_EXPR]: Handle new flags.
	* pt.c (tsubst_copy_and_build): Copy new flags.
	* semantics.c (simplify_aggr_init_expr): Likewise.
	* tree.c (build_aggr_init_expr): Likewise.
	(build_min_non_dep_op_overload): Likewise.

From-SVN: r237459
2016-06-14 16:18:34 -04:00
Paolo Carlini f07063cc7a pt.c (tsubst, [...]): Don't delay checking the return value of tsubst_aggr_type for error_mark_node.
2016-06-08  Paolo Carlini  <paolo.carlini@oracle.com>

	* pt.c (tsubst, case TYPENAME_TYPE): Don't delay checking the
	return value of	tsubst_aggr_type for error_mark_node.

From-SVN: r237236
2016-06-08 18:29:42 +00:00
Jakub Jelinek 2ef16b6eb2 re PR c++/71442 (r232569 breaks -Wunused-*)
PR c++/71442
	* pt.c (tsubst_copy): Only set TREE_USED on DECLs.

	* g++.dg/cpp0x/Wunused-variable-1.C: New test.

From-SVN: r237232
2016-06-08 19:57:30 +02:00
Jason Merrill 8d857afc86 * pt.c (instantiate_decl): Avoid recalculation.
From-SVN: r236947
2016-05-31 15:49:22 -04:00
Jason Merrill 1f032c533f PR c++/60095 - partial specialization of variable templates
PR c++/69515
	PR c++/69009
	* pt.c (instantiate_template_1): Don't put the partial
	specialization in DECL_TI_TEMPLATE.
	(partial_specialization_p, impartial_args): Remove.
	(regenerate_decl_from_template): Add args parm.
	(instantiate_decl): Look up the partial specialization again.

From-SVN: r236946
2016-05-31 15:49:16 -04:00
Jason Merrill f795360d35 PR c++/71227 - specializing hidden friend
* pt.c (check_explicit_specialization): Give better diagnostic about
	specializing a hidden friend.

From-SVN: r236941
2016-05-31 15:16:26 -04:00
Patrick Palka cac177cfad Fix PR c++/70822 (bogus error with parenthesized SCOPE_REF)
gcc/cp/ChangeLog:

	PR c++/70822
	PR c++/70106
	* cp-tree.h (REF_PARENTHESIZED_P): Make this flag apply to
	SCOPE_REFs too.
	* pt.c (tsubst_qualified_id): If REF_PARENTHESIZED_P is set
	on the qualified_id then propagate it to the resulting
	expression.
	(do_auto_deduction): Check REF_PARENTHESIZED_P on SCOPE_REFs
	too.
	* semantics.c (force_paren_expr): If given a SCOPE_REF, just set
	its REF_PARENTHESIZED_P flag.

gcc/testsuite/ChangeLog:

	PR c++/70822
	PR c++/70106
	* g++.dg/cpp1y/auto-fn32.C: New test.
	* g++.dg/cpp1y/paren4.C: New test.

From-SVN: r236792
2016-05-26 18:17:43 +00:00
Martin Sebor f65e97fd3d PR c++/71147 - [6 Regression] Flexible array member wrongly rejected in template
gcc/ChangeLog:
2016-05-24  Martin Sebor  <msebor@redhat.com>

	PR c++/71147
	* gcc/tree.h (complete_or_array_type_p): New inline function.

gcc/testsuite/ChangeLog:
2016-05-24  Martin Sebor  <msebor@redhat.com>

	PR c++/71147
	* g++.dg/ext/flexary16.C: New test.

gcc/cp/ChangeLog:
2016-05-24  Martin Sebor  <msebor@redhat.com>

	PR c++/71147
	* decl.c (layout_var_decl, grokdeclarator): Use complete_or_array_type_p.
	* pt.c (instantiate_class_template_1): Try to complete the element
	type of a flexible array member.
	(can_complete_type_without_circularity): Handle arrays of unknown bound.
	* typeck.c (complete_type): Also complete the type of the elements of
	arrays with an unspecified bound.

From-SVN: r236664
2016-05-24 14:29:36 -06:00
Jason Merrill 9c62c1f364 PR c++/70735 - generic lambda and local static variable
* pt.c (tsubst_copy): Just return a local variable from
	non-template context.  Don't call rest_of_decl_compilation for
	duplicated static locals.
	(tsubst_decl): Set DECL_CONTEXT of local static from another
	function.

From-SVN: r236615
2016-05-23 17:21:18 -04:00
Paolo Carlini 396a1d10b3 pt.c (check_for_bare_parameter_packs): Improve error message location for expressions.
/cp
2016-05-23  Paolo Carlini  <paolo.carlini@oracle.com>

	* pt.c (check_for_bare_parameter_packs): Improve error message
	location for expressions.

/testsuite
2016-05-23  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/cpp0x/pr31445.C: Test column number too.
	* g++.dg/cpp0x/pr32253.C: Likewise.
	* g++.dg/cpp0x/variadic-ex13.C: Likewise.
	* g++.dg/cpp0x/variadic36.C: Likewise.

From-SVN: r236609
2016-05-23 19:20:41 +00:00
Marek Polacek 2a5569fad3 re PR c++/71075 (Broken diagnostic: 'integer_cst' not supported by 'dump_decl')
PR c++/71075
	* pt.c (unify_template_argument_mismatch): Use %qE instead of %qD.

	* g++.dg/diagnostic/pr71075.C: New test.

From-SVN: r236487
2016-05-19 20:23:52 +00:00
Jason Merrill a7dd5069bb Fix handling of non-dependent calls with default template args.
PR c++/10200
	* pt.c (fn_type_unification): Add outer template args if needed.
	(type_unification_real): Handle getting full args.

From-SVN: r236486
2016-05-19 15:20:40 -04:00
Jason Merrill 8f74423d5b pt.c (value_dependent_expression_p): Tweak new cases to better match the wording in the standard.
* pt.c (value_dependent_expression_p): Tweak new cases to better
	match the wording in the standard.

From-SVN: r236421
2016-05-18 13:43:18 -04:00
Jason Merrill 23cb726630 Fix type-dependence and the current instantiation.
PR c++/10200
	PR c++/69753
	* pt.c (tsubst_decl): Use uses_template_parms.
	(instantiate_template_1): Handle non-dependent calls in templates.
	(value_dependent_expression_p): Handle BASELINK, FUNCTION_DECL.
	(type_dependent_expression_p): Only consider innermost template	args.
	(dependent_template_arg_p): Check enclosing class of a template here.
	(dependent_template_p): Not here.
	(type_dependent_object_expression_p): New.
	* typeck.c (finish_class_member_access_expr): Use it.
	* parser.c (cp_parser_postfix_expression): Use it.
	(cp_parser_postfix_dot_deref_expression): Use it.  Use comptypes
	to detect the current instantiation.
	(cp_parser_lookup_name): Really implement DR 141.
	* search.c (lookup_field_r): Prefer a dependent using-declaration.
	(any_dependent_bases_p): Split out from...
	* name-lookup.c (do_class_using_decl): ...here.
	* call.c (build_new_method_call_1): Use it.
	* semantics.c (finish_call_expr): 'this' doesn't make a call dependent.
	* tree.c (non_static_member_function_p): Remove.
	* typeck2.c (build_x_arrow): Use dependent_scope_p.

From-SVN: r236221
2016-05-13 15:18:35 -04:00
Cesar Philippidis 778864283e c-common.h (enum c_omp_region_type): Define.
gcc/c-family/
	* c-common.h (enum c_omp_region_type): Define.

	gcc/c/
	* c-parser.c (c_parser_oacc_all_clauses): Update call to
	c_finish_omp_clauses.
	(c_parser_omp_all_clauses): Likewise.
	(c_parser_oacc_cache): Likewise.
	(c_parser_oacc_loop): Likewise.
	(omp_split_clauses): Likewise.
	(c_parser_omp_declare_target): Likewise.
	(c_parser_cilk_all_clauses): Likewise.
	(c_parser_cilk_for): Likewise.
	* c-typeck.c (c_finish_omp_clauses): Replace bool arguments
	is_omp, declare_simd, and is_cilk with enum c_omp_region_type ort.

	gcc/cp/
	* cp-tree.h (finish_omp_clauses): Update prototype.
	* parser.c (cp_parser_oacc_all_clauses): Update call to
	finish_omp_clauses.
	(cp_parser_omp_all_clauses): Likewise.
	(cp_parser_omp_for_loop): Likewise.
	(cp_omp_split_clauses): Likewise.
	(cp_parser_oacc_cache): Likewise.
	(cp_parser_oacc_loop): Likewise.
	(cp_parser_omp_declare_target):
	(cp_parser_cilk_simd_all_clauses): Likewise.
	(cp_parser_cilk_for): Likewise.
	* pt.c (tsubst_omp_clauses): Replace allow_fields and declare_simd
	arguments with enum c_omp_region_type ort.
	(tsubst_omp_clauses): Update calls to finish_omp_clauses.
	(tsubst_omp_attribute): Update calls to tsubst_omp_clauses.
	(tsubst_omp_for_iterator): Update calls to finish_omp_clauses.
	(tsubst_expr): Update calls to tsubst_omp_clauses.
	* semantics.c (finish_omp_clauses): Replace bool arguments
	allow_fields, declare_simd, and is_cilk with bitmask ort.
	(finish_omp_for): Update call to finish_omp_clauses.

From-SVN: r235780
2016-05-02 11:49:15 -07:00
Jakub Jelinek 7db11a5a32 re PR bootstrap/70704 (AIX bootstrap comparison failure)
PR bootstrap/70704
	* configure.ac (--enable-stage1-checking): For --disable-checking or
	implicit --enable-checking, make sure extra flag matches in between
	stage1 and later checking.
	* configure: Regenerated.
gcc/
	* configure.ac (--enable-checking): Document extra flag, for
	non-release builds default to --enable-checking=yes,extra.
	If misc checking and extra checking, define CHECKING_P to 2 instead
	of 1.
	* common.opt (fchecking=): Add.
	* doc/invoke.texi (-fchecking=): Document.
	* doc/install.texi: Document --enable-checking changes.
	* configure: Regenerated.
	* config.in: Regenerated.
gcc/cp/
	* pt.c (build_non_dependent_expr): Use flag_checking > 1 instead of
	just flag_checking.

From-SVN: r235430
2016-04-26 08:10:43 +02:00
Jason Merrill 76f3944041 PR c++/66543 - -Wunused-but-set* false positives
* expr.c (mark_exp_read): Handle NON_DEPENDENT_EXPR.
	* pt.c (make_pack_expansion): Call mark_exp_read.
	* semantics.c (finish_id_expression): Call mark_type_use in
	unevaluated context.

From-SVN: r235221
2016-04-19 15:30:22 -04:00
Jason Merrill b1e47084d3 Tiny C++ cleanups.
* pt.c (tsubst_expr): Remove shadowing declaration.
	(tsubst_pack_expansion): Add assert.
	* semantics.c (add_decl_expr): Use DECL_SOURCE_LOCATION.

From-SVN: r235213
2016-04-19 13:49:34 -04:00
Michael Matz fe37c7afd1 tree.h (TYPE_ALIGN, DECL_ALIGN): Return shifted amount.
* 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-04-18 20:36:27 +00:00
Jason Merrill a7b12f1f3e re PR c++/70505 (Constexpr failure when template type specified)
PR c++/70505

	* pt.c (tsubst_baselink): Give the new TEMPLATE_ID_EXPR
	unknown_type_node, too.

From-SVN: r235042
2016-04-15 12:32:22 -04:00
Jason Merrill d25a101fe7 re PR c++/70543 (wrong non-const error for enable_if and constexpr function)
PR c++/70543

	* pt.c (value_dependent_expression_p) [VAR_DECL]: A type-dependent
	initializer also makes the variable value-dependent.

From-SVN: r234990
2016-04-14 16:14:44 -04:00
Paolo Carlini 545a4139d5 re PR c++/70635 (ICE on (and rejects) valid code on x86_64-linux-gnu: Segmentation fault (program cc1plus))
/cp
2016-04-13  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/70635
	* pt.c (resolve_typename_type): Fix typos in infinite recursion
	avoidance mechanism.

/testsuite
2016-04-13  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/70635
	* g++.dg/parse/pr70635.C: New.

From-SVN: r234953
2016-04-13 17:11:03 +00:00
Jason Merrill 463d91c64d re PR c++/70634 (ICE on valid code on x86_64-linux-gnu: Segmentation fault (program cc1plus))
PR c++/70634

	* pt.c (instantiation_dependent_uneval_expression_p): Split out
	from instantiation_dependent_expression_p.
	(value_dependent_expression_p): Use it for unevaluated operands.
	(instantiation_dependent_r): Don't check value-dependence.
	(instantiation_dependent_expression_p): Check
	value-dependence of the expression as a whole.
	* cp-tree.h: Declare instantiation_dependent_uneval_expression_p.
	* semantics.c (finish_decltype_type): Use it.

From-SVN: r234945
2016-04-13 11:02:23 -04:00
Jason Merrill eb07f187a4 constexpr.c (potential_nondependent_constant_expression): New.
* constexpr.c (potential_nondependent_constant_expression): New.
	(potential_nondependent_static_init_expression): New.
	(maybe_constant_value_1, fold_non_dependent_expr)
	(maybe_constant_init): Use them.
	* pt.c (instantiate_non_dependent_expr_sfinae)
	(instantiate_non_dependent_or_null, convert_nontype_argument): Use
	them.
	* cp-tree.h: Declare them.

From-SVN: r234944
2016-04-13 11:02:17 -04:00
Jason Merrill ddd6d4211a re PR c++/70449 (ICE with -Wall on valid code on x86_64-linux-gnu in pp_string, at pretty-print.c:928)
PR c++/70449

	PR c++/70344
	* pt.c (instantiate_decl): A function isn't fully defined if
	DECL_INITIAL is error_mark_node.
	* constexpr.c (cxx_eval_call_expression): Likewise.

From-SVN: r234695
2016-04-01 21:35:45 -04:00
Jason Merrill bfec0b4d57 re PR bootstrap/70422 (Bootstrap comparison failure)
PR c++/70422

	PR c++/64266
	PR c++/70353
	* decl.c, pt.c, constexpr.c: Revert last patch.

From-SVN: r234511
2016-03-28 16:16:21 -04:00
Jason Merrill d7796e23a4 re PR c++/64266 (Can GCC produce local mergeable symbols for *.__FUNCTION__ and *.__PRETTY_FUNCTION__ functions?)
PR c++/64266
	PR c++/70353
	Core issue 1962
	* decl.c (cp_fname_init): Decay the initializer to pointer.
	(cp_make_fname_decl): Set DECL_DECLARED_CONSTEXPR_P,
	DECL_VALUE_EXPR, DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
	Don't call cp_finish_decl.
	* pt.c (tsubst_expr) [DECL_EXPR]: Set DECL_VALUE_EXPR,
	DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.  Don't call cp_finish_decl.
	* constexpr.c (cxx_eval_constant_expression) [VAR_DECL]:
	Handle DECL_VALUE_EXPR.

Co-Authored-By: Martin Liska <mliska@suse.cz>

From-SVN: r234484
2016-03-25 17:29:26 -04:00
Patrick Palka cd1588c4d6 Fix PR c++/70332 (ICE due to aggregate initialization of NSDMI)
gcc/cp/ChangeLog:

	PR c++/70332
	* pt.c (tsubst_copy) [PARM_DECL]: Handle the use of 'this' in an
	NSDMI that's part of an aggregrate initialization.

gcc/testsuite/ChangeLog:

	PR c++/70332
	* g++.dg/cpp1y/nsdmi-aggr5.C: New test.

From-SVN: r234442
2016-03-23 21:02:34 +00:00
Marek Polacek fbdb6bafe2 re PR c++/69884 (warning: ignoring attributes on template argument)
PR c++/69884
	* c.opt (Wignored-attributes): New option.

	* pt.c (canonicalize_type_argument): Use OPT_Wignored_attributes.

	* doc/invoke.texi: Document -Wignored-attributes.

	* g++.dg/warn/Wignored-attributes-1.C: New test.
	* g++.dg/warn/Wignored-attributes-2.C: New test.

From-SVN: r234433
2016-03-23 17:51:56 +00:00
Patrick Palka 16f6d7dc5c Fix PR c++/70096 (wrong code for pointer-to-member-function copy)
gcc/cp/ChangeLog:

	PR c++/70096
	* pt.c (tsubst_decl): Clear the DECL_MODE of the new decl.

gcc/testsuite/ChangeLog:

	PR c++/70096
	* g++.dg/template/ptrmem30.C: New test.

From-SVN: r234391
2016-03-22 02:02:01 +00:00
Jason Merrill d1ccf407da re PR c++/70095 ([C++14] Link error on partially specialized variable template)
PR c++/70095
	* pt.c (instantiate_decl): Fix call to variable_template_p.

From-SVN: r234231
2016-03-15 15:37:37 -04:00
Jason Merrill 3f91db69ca re PR c++/70141 (template parameter not deducible in partial specialization of template inside template)
PR c++/70141
	* pt.c (for_each_template_parm_r): Always walk into TYPENAME_TYPE.

From-SVN: r234228
2016-03-15 15:21:44 -04:00
Jason Merrill 1e546b68c1 P0036R0: Unary Folds and Empty Parameter Packs
* pt.c (expand_empty_fold): Remove special cases for *,+,&,|.

From-SVN: r234068
2016-03-08 17:30:30 -05:00
Patrick Palka dbb23418b2 Adjust fix for PR c++/66786
gcc/cp/ChangeLog:

	PR c++/66786
	* pt.c (get_template_info): Handle PARM_DECL.
	(template_class_depth): Check DECL_P instead of
	VAR_OR_FUNCTION_DECL_P.

From-SVN: r234038
2016-03-07 17:09:53 +00:00
Patrick Palka 7a3a3fadb0 Fix PR c++/66786 (ICE with nested lambdas in variable template)
gcc/cp/ChangeLog:

	PR c++/66786
	* pt.c (template_class_depth): Given a lambda type, iterate
	into its LAMBDA_TYPE_EXTRA_SCOPE field instead of its
	TYPE_CONTEXT.  Given a VAR_DECL, iterate into its
	CP_DECL_CONTEXT.

gcc/testsuite/ChangeLog:

	PR c++/66786
	* g++.dg/cpp1y/var-templ48.C: New test.
	* g++.dg/cpp1y/var-templ49.C: New test.

From-SVN: r233997
2016-03-05 01:59:04 +00:00
Jason Merrill a0a6a8c966 pt.c (tsubst_copy_and_build): Get LAMBDA_EXPR_RETURN_TYPE from the instantiated closure.
* pt.c (tsubst_copy_and_build) [LAMBDA_EXPR]: Get
	LAMBDA_EXPR_RETURN_TYPE from the instantiated closure.

From-SVN: r233955
2016-03-03 20:45:48 -05:00
Jason Merrill 264fd1424e re PR c++/67164 (ICE: tree check: expected class ‘expression’, have ‘exceptional’ (argument_pack_select) in tree_operand_check, at tree.h:3356)
PR c++/67164

	* pt.c (copy_template_args): New.
	(tsubst_pack_expansion): Use it.

From-SVN: r233954
2016-03-03 20:45:43 -05:00
Patrick Palka 76d881bfdd Fix PR c++/69961 (invalid ctor call with dependent args)
gcc/cp/ChangeLog:

	PR c++/68948
	PR c++/69961
	* pt.c (tsubst_baselink): Reinstate the check for an invalid
	constructor call.

gcc/testsuite/ChangeLog:

	PR c++/69961
	* g++.dg/template/pr69961a.C: New test.
	* g++.dg/template/pr69961b.C: New test.

From-SVN: r233838
2016-03-01 01:24:44 +00:00
Jason Merrill 56cde07776 re PR c++/69958 (sizeof... computes wrong size)
PR c++/69958
	* pt.c (make_argument_pack): New.
	(tsubst_copy) [SIZEOF_EXPR]: Handle partial expansion.
	(tsubst_copy_and_build): Likewise.

From-SVN: r233758
2016-02-26 14:54:33 -05:00
Patrick Palka 1137001cd9 re PR c++/69736 ("error: too few arguments to function" in c++14 but not c++11)
Fix PR c++/69736

gcc/cp/ChangeLog:

	PR c++/69736
	* cp-tree.h (REF_PARENTHESIZED_P): Adjust documentation.
	(maybe_undo_parenthesized_ref): Declare.
	* semantics.c (maybe_undo_parenthesized_ref): Split out from
	check_return_expr.
	(finish_call_expr): Use it.
	* typeck.c (check_return_expr): Use it.
	* pt.c (tsubst_copy_and_build) [INDIRECT_REF]: Retain the
	REF_PARENTHESIZED_P flag.

gcc/testsuite/ChangeLog:

	PR c++/69736
	* g++.dg/cpp1y/paren2.C: New test.

From-SVN: r233691
2016-02-25 01:14:27 +00:00
Jason Merrill b8599b68ed PR c++/69323 - valid
* pt.c (instantiate_class_template_1): Set
	processing_template_decl before substituting friend_type.

From-SVN: r233681
2016-02-24 14:56:03 -05:00
Jason Merrill 2207c59959 re PR c++/69743 (function overload with variadic arguments - template instantiation depth exceeds maximum (gcc4, clang - no problem))
PR c++/69743
	* call.c (remaining_arguments): No longer static.
	* cp-tree.h: Declare it.
	* pt.c (more_specialized_fn): Use it.

From-SVN: r233579
2016-02-19 23:31:16 -05:00
Patrick Palka 200e869c8f Adjust fix PR c++/68948
gcc/cp/ChangeLog:

	PR c++/68948
	* pt.c (tsubst_baselink): Don't diagnose an invalid constructor
	call here.
	* semantics.c (finish_call_expr): Don't assume a constructor
	call is dependent if only the "this" pointer is dependent.  When
	building a constructor call, always use a dummy object.

From-SVN: r233563
2016-02-19 17:04:29 +00:00
Jason Merrill 6bab4c63c4 re PR c++/10200 (Weird clash with same names in different scopes)
PR c++/10200
	PR c++/69753
	* call.c, cp-tree.h, name-lookup.c, pt.c, search.c, semantics.c,
	tree.c, typeck2.c: Revert earlier changes.
	* parser.c (cp_parser_lookup_name): Ignore namespace-scope
	non-type templates after -> or .

From-SVN: r233481
2016-02-16 19:50:23 -05:00
Jason Merrill 2bd0a2d6b1 re PR c++/69753 (bogus: expected primary-expression before ‘>’ token)
PR c++/69753

	* search.c (any_dependent_bases_p): Split out...
	* name-lookup.c (do_class_using_decl): ...from here.
	* call.c (build_new_method_call_1): Don't complain about missing object
	if there are dependent bases.  Tweak error.
	* tree.c (non_static_member_function_p): Remove.
	* pt.c (type_dependent_expression_p): A member template of a
	dependent type is dependent.
	* cp-tree.h: Adjust.

From-SVN: r233431
2016-02-15 16:14:05 -05:00
Patrick Palka 38d795d27c Fix PR c++/69098 (bogus errors with static data member template)
gcc/cp/ChangeLog:

	PR c++/69098
	* pt.c (lookup_and_finish_template_variable): New function,
	extracted from ...
	(tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: ... here.
	(tsubst_qualified_id): Consider that EXPR might be a variable
	template.
	* typeck.c (check_template_keyword): Don't emit an error
	if DECL is a variable template.

gcc/testsuite/ChangeLog:

	PR c++/69098
	* g++.dg/cpp1y/69098.C: New test.
	* g++.dg/cpp1y/69098-2.C: New test.

From-SVN: r233365
2016-02-12 01:11:52 +00:00
Paolo Carlini 4146b7b8c4 re PR c++/68726 (ice: tree check: expected tree_vec, have error_mark in comp_template_args_with_info, at cp/pt.c:7890)
/cp
2016-02-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/68726
	* pt.c (lookup_template_class_1): Check tsubst return value for
	error_mark_node.

/testsuite
2016-02-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/68726
	* g++.dg/cpp0x/pr68726.C: New.

From-SVN: r233340
2016-02-11 11:45:10 +00:00
Jason Merrill 46f0d909aa re PR c++/68926 (decltype and sfinae to check for template instance availability fails to compile)
PR c++/68926

	* pt.c (resolve_nondeduced_context): Add complain parm.
	(do_auto_deduction): Pass it.
	* cvt.c (convert_to_void): Likewise.
	* decl.c (cp_finish_decl): Likewise.
	* init.c (build_new): Likewise.
	* rtti.c (get_tinfo_decl_dynamic): Likewise.
	* semantics.c (finish_decltype_type): Likewise.
	* typeck.c (decay_conversion): Likewise.
	* cp-tree.h: Adjust declaration.
	* call.c (standard_conversion): Add complain parm, pass it along.
	(implicit_conversion): Pass it.

From-SVN: r233304
2016-02-10 14:12:32 -05:00
Patrick Palka 76c85fbbe7 Fix PR c++/68948 (wrong code generation due to invalid constructor call)
gcc/cp/ChangeLog:

	PR c++/68948
	* pt.c (tsubst_baselink): Diagnose an invalid constructor call
	if lookup_fnfields returns NULL_TREE and the name being looked
	up has the form A::A.

gcc/testsuite/ChangeLog:

	PR c++/68948
	* g++.dg/template/pr68948.C: New test.

From-SVN: r233176
2016-02-05 14:36:44 +00:00
Martin Sebor 05dd97db3c PR c++/69251 - [6 Regression] ICE in unify_array_domain on a flexible array
PR c++/69251 - [6 Regression] ICE in unify_array_domain on a flexible array
               member
PR c++/69253 - [6 Regression] ICE in cxx_incomplete_type_diagnostic initializing
               a flexible array member with empty string
PR c++/69290 - [6 Regression] ICE on invalid initialization of a flexible array
               member
PR c++/69277 - [6 Regression] ICE mangling a flexible array member
PR c++/69349 - template substitution error for flexible array members

gcc/testsuite/ChangeLog:
2016-02-03  Martin Sebor  <msebor@redhat.com>

	PR c++/69251
	PR c++/69253
	PR c++/69290
	PR c++/69277
	PR c++/69349
	* g++.dg/ext/flexarray-mangle-2.C: New test.
	* g++.dg/ext/flexarray-mangle.C: New test.
	* g++.dg/ext/flexarray-subst.C: New test.
	* g++.dg/ext/flexary11.C: New test.
	* g++.dg/ext/flexary12.C: New test.
	* g++.dg/ext/flexary13.C: New test.
	* g++.dg/ext/flexary14.C: New test.
	* g++.dg/other/dump-ada-spec-2.C: Adjust.

gcc/cp/ChangeLog:
2016-02-03  Martain Sebor  <msebor@redhat.com>

	PR c++/69251
	PR c++/69253
	PR c++/69290
	PR c++/69277
	PR c++/69349
	* class.c (walk_subobject_offsets): Avoid testing the upper bound
	of a flexible array member for equality to null.
	(find_flexarrays): Remove spurious whitespace introduced in r231665.
	(diagnose_flexarrays): Avoid checking the upper bound of arrays.
	(check_flexarrays): Same.
	* decl.c (compute_array_index_type): Avoid special case for flexible
	array members.
	(grokdeclarator): Avoid calling compute_array_index_type for flexible
	array members.
	* error.c (dump_type_suffix): Revert changes introduced in r231665
	and rendered unnecessary by the changes above.
	* pt.c (tsubst):  Same.
	* tree.c (build_ctor_subob_ref): Handle flexible array members.
	* typeck2.c (digest_init_r): Revert changes introduced in r231665.
	(process_init_constructor_array): Same.
	(process_init_constructor_record): Same.

From-SVN: r233126
2016-02-03 21:50:42 -07:00
Patrick Palka ab4bae0c13 Fix PR c++/69056 (argument pack deduction failure during overload resolution)
gcc/cp/ChangeLog:

	PR c++/69056
	* pt.c (try_one_overload): Handle comparing argument packs so
	that there is no conflict if we deduced more arguments of an
	argument pack than were explicitly specified.

gcc/testsuite/ChangeLog:

	PR c++/69056
	g++.dg/cpp0x/pr69056.C: New test.

From-SVN: r233108
2016-02-03 20:14:43 +00:00
Jason Merrill 6978c505d0 re PR c++/69009 (ICE in instantiate_decl, at cp/pt.c:21511)
PR c++/69009

	* pt.c (partial_specialization_p, impartial_args): New.
	(instantiate_decl): Call impartial_args.

From-SVN: r233019
2016-01-31 06:53:04 -05:00
Jason Merrill b676a0798f Fix abi-tag17.C.
* pt.c (lookup_template_class_1): Don't share TYPE_ATTRIBUTES
	between template and instantiation.

From-SVN: r233017
2016-01-31 06:52:48 -05:00
Patrick Palka a59b92b0c7 Revert "Fix the remaining PR c++/24666 blockers"
gcc/cp/ChangeLog:

	Revert:
	2016-01-18  Patrick Palka  <ppalka@gcc.gnu.org>

	PR c++/11858
	PR c++/24663
	PR c++/24664
	* decl.c (grokdeclarator): Don't decay array parameter type to
	a pointer type if it's dependent.
	(grokparms): Invoke strip_top_quals instead of directly invoking
	cp_build_qualified_type.
	* pt.c (decay_dependent_array_parm_type): New static function.
	(type_unification_real): Call decay_dependent_array_parm_type
	to decay a dependent array parameter type to its corresponding
	pointer type before unification.
	(more_specialized_fn): Likewise.
	(get_bindings): Likewise.
	* tree.c (cp_build_qualified_type): Trivial typofix in
	documentation.

gcc/testsuite/ChangeLog:

	Revert:
	2016-01-18  Patrick Palka  <ppalka@gcc.gnu.org>

	PR c++/11858
	PR c++/24663
	PR c++/24664
	* g++.dg/template/pr11858.C: New test.
	* g++.dg/template/pr24663.C: New test.
	* g++.dg/template/unify12.C: New test.
	* g++.dg/template/unify13.C: New test.
	* g++.dg/template/unify14.C: New test.
	* g++.dg/template/unify15.C: New test.
	* g++.dg/template/unify16.C: New test.
	* g++.dg/template/unify17.C: New test.

From-SVN: r232778
2016-01-24 17:45:21 +00:00
Jason Merrill 97ca3d0d59 re PR c++/43407 (Specifying visibility attribute of C++0x enum class emits warning)
PR c++/43407
	* decl.c (start_enum): Add attributes parameter.
	* parser.c (cp_parser_enum_specifier): Pass it.
	* pt.c (lookup_template_class_1): Pass it.
	* cp-tree.h: Adjust.

From-SVN: r232701
2016-01-21 15:26:02 -05:00
Jason Merrill 33f4884259 re PR c++/59759 (internal compiler error: in unify, using std::enable_if on classes)
PR c++/59759
	* pt.c (convert_template_argument): Handle VAR_DECL properly.

From-SVN: r232580
2016-01-19 14:00:21 -05:00
Marek Polacek 38a979f288 re PR c++/68965 (`-Wunused-parameter` is reported in variadic lambda or function using sizeof...(xs))
PR c++/68965
	* pt.c (tsubst_copy): Mark elements in expanded vector as used.

	* g++.dg/cpp1y/parameter-pack-1.C: New test.
	* g++.dg/cpp1y/parameter-pack-2.C: New test.

From-SVN: r232569
2016-01-19 14:37:49 +00:00
Patrick Palka 17c15cb932 Fix the remaining PR c++/24666 blockers (arrays decay to pointers too early)
gcc/cp/ChangeLog:

	PR c++/11858
	PR c++/24663
	PR c++/24664
	* decl.c (grokdeclarator): Don't decay array parameter type to
	a pointer type if it's dependent.
	(grokparms): Invoke strip_top_quals instead of directly invoking
	cp_build_qualified_type.
	* pt.c (decay_dependent_array_parm_type): New static function.
	(type_unification_real): Call decay_dependent_array_parm_type
	to decay a dependent array parameter type to its corresponding
	pointer type before unification.
	(more_specialized_fn): Likewise.
	(get_bindings): Likewise.
	* tree.c (cp_build_qualified_type): Trivial typofix in
	documentation.

gcc/testsuite/ChangeLog:

	PR c++/11858
	PR c++/24663
	PR c++/24664
	* g++.dg/template/pr11858.C: New test.
	* g++.dg/template/pr24663.C: New test.
	* g++.dg/template/unify12.C: New test.
	* g++.dg/template/unify13.C: New test.
	* g++.dg/template/unify14.C: New test.
	* g++.dg/template/unify15.C: New test.
	* g++.dg/template/unify16.C: New test.
	* g++.dg/template/unify17.C: New test.

From-SVN: r232547
2016-01-19 00:19:16 +00:00
Patrick Palka ec7886c19b Fix PR c++/69091 (ICE with operator overload having 'auto' return type)
gcc/cp/ChangeLog:

	PR c++/69091
	* pt.c (type_dependent_expression_p): For a function template
	specialization, a type is dependent iff any of its template
	arguments are.

gcc/testsuite/ChangeLog:

	PR c++/69091
	* g++.dg/template/pr69091.C: New test.

From-SVN: r232463
2016-01-16 02:37:09 +00:00
Jakub Jelinek 723033a6b2 re PR c++/66808 (tree check fail in symbol_table::decl_assembler_name_hash)
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-12 09:21:53 +01:00
Nathan Sidwell ce3e43d7c8 re PR c++/58583 ([c++11] ICE with invalid non-static data member 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-05 14:40:11 +00:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Thomas Schwinge c7b48c8ae5 Merge OMP_CLAUSE_USE_DEVICE into OMP_CLAUSE_USE_DEVICE_PTR
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-23 12:01:18 +01:00
Patrick Palka 6be028226e Fix read of uninitialized value in make_pack_expansion()
gcc/cp/ChangeLog:

	* pt.c (make_pack_expansion): Make sure to initialize
	ppd.type_pack_expansion_p.

From-SVN: r231904
2015-12-22 17:49:21 +00:00
Jason Merrill 72013ec51a re PR c++/67411 (internal compiler error: in tsubst_copy, at cp/pt.c:13473)
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-20 13:38:37 -05:00
Paolo Carlini 6cb6583c5f pt.c (comp_template_args): Remove.
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-16 21:45:14 +00:00
Jason Merrill 4793cbbaa5 re PR c++/68309 (ICE: Segmentation fault)
PR c++/68309
	* pt.c (instantiate_decl): Revert earlier change.

From-SVN: r231714
2015-12-16 13:22:23 -05:00
Jason Merrill 65016251f6 re PR c++/63628 ([c++1y] cannot use decltype on captured arg-pack)
PR c++/63628
	* pt.c (tsubst_pack_expansion): Also make dummy decls if
	retrieve_local_specialization fails.

From-SVN: r231713
2015-12-16 13:22:17 -05:00
Martin Sebor 7e9a3ad300 struct-layout-1_generate.c: Avoid generating further fields after the first 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-15 14:04:08 -07:00
Jason Merrill fa583f9e65 re PR c++/68309 (ICE: Segmentation fault)
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-14 15:54:17 -05:00
Jason Merrill 7873d5fbc3 re PR c++/68170 (Declaring friend template class template in C++1z produces error: specialization of ‘template<class T> class A’ must appear at namespace)
PR c++/68170
	* pt.c (maybe_new_partial_specialization): The injected-class-name
	is not a new partial specialization.

From-SVN: r231380
2015-12-07 14:34:04 -05:00
Jason Merrill aabdb83166 Fix memclass5.C, memfriend10.C, var-templ19.C with -std=c++1z.
* constraint.cc (strictly_subsumes): New.
	* cp-tree.h: Declare it.
	* pt.c (process_partial_specialization): Use it instead of
	subsumes_constraints.
	(maybe_new_partial_specialization): Do compare null constraints.
	* search.c (lookup_member): Handle currently_open_class returning null.

From-SVN: r231350
2015-12-06 23:34:51 -05:00
Jason Merrill 5dc5804917 PR c++/68597, fix auto9.C and auto-neg1.C with -std=c++1z.
* decl.c (check_tag_decl): Use ds_type_spec in auto diagnostic.
	* typeck.c (check_return_expr): Check for inconsistent deduction.
	* parser.c (class type_id_in_expr_sentinel): New.
	(cp_parser_primary_expression) [RID_VA_ARG]: Use it.
	(cp_parser_new_expression): Use it.
	(cp_parser_trait_expr): Use it.
	(cp_parser_type_id_1): Complain about auto if in_type_id_in_expr_p.
	(cp_parser_default_type_template_argument): Check for auto.
	(cp_parser_type_id_list): Likewise.
	(cp_parser_simple_type_specifier): Allow auto parms if flag_concepts.
	* pt.c (do_auto_deduction): Handle erroneous type.

From-SVN: r231349
2015-12-06 23:34:43 -05:00
Eric Botcazou f4886d807d re PR c++/68290 (g++.dg/concepts/auto1.C FAILs)
PR c++/68290
	* constraint.cc (make_constrained_auto): Move to...
	* pt.c (make_auto_1): Add set_canonical parameter and set
	TYPE_CANONICAL on the type only if it is true.
	(make_decltype_auto): Adjust call to make_auto_1.
	(make_auto): Likewise.
	(splice_late_return_type): Likewise.
	(make_constrained_auto): ...here.  Call make_auto_1 instead of
	make_auto and pass false.  Set TYPE_CANONICAL directly.

From-SVN: r231189
2015-12-02 16:41:02 +00:00
Thomas Schwinge ff7a55bf56 Some OpenACC host_data cleanup
gcc/c/
	* c-parser.c (c_parser_omp_clause_name)
	(c_parser_oacc_all_clauses): Alphabetical sorting.
	gcc/cp/
	* parser.c (cp_parser_omp_clause_name)
	(cp_parser_oacc_all_clauses): Alphabetical sorting.
	* pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_USE_DEVICE.
	gcc/testsuite/
	* c-c++-common/goacc/host_data-5.c: New file.
	* c-c++-common/goacc/host_data-6.c: Likewise.
	* gfortran.dg/goacc/coarray.f95: XFAIL.
	* gfortran.dg/goacc/coarray_2.f90: Adjust dg-excess-errors
	directive.
	* gfortran.dg/goacc/host_data-tree.f95: Remove dg-prune-output
	directive.
	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/host_data-2.c: Restrict to
	target openacc_nvidia_accel_selected.
	* testsuite/libgomp.oacc-c-c++-common/host_data-4.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/host_data-5.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/host_data-3.c: Remove file.
	* testsuite/libgomp.oacc-c-c++-common/host_data-6.c: Remove file.

Co-Authored-By: James Norris <James_Norris@mentor.com>
Co-Authored-By: Julian Brown <julian@codesourcery.com>

From-SVN: r231184
2015-12-02 16:53:34 +01:00
Martin Sebor e82f9ef748 PR c++/67876 - [6 Regression] ICE when compiling Firefox 38
gcc/cp
	* pt.c (convert_template_argument): Make sure number of tree
	operands is greater than zero before attempting to extract one.

gcc/testsuite/
	* g++.dg/pr67876.C: New test.

From-SVN: r230924
2015-11-25 18:52:04 -07:00
Ryan Burn a0c0e716fa re PR c++/68434 ([concepts] function tsubst sets TYPE_CANONICAL before setting a type's PLACEHOLDER_TYPE_CONSTRAINTS)
PR c++/68434

	* pt.c (tsubst): Set PLACEHOLDER_TYPE_CONSTRAINTS before
	calling canonical_type_parameter.

From-SVN: r230909
2015-11-25 17:13:23 -05:00
Jason Merrill e3f8abd61e re PR c++/68422 (compile-time cost of sizeof... is quadratic)
PR c++/68422

	* cp-tree.h (PACK_EXPANSION_SIZEOF_P): New.
	* parser.c (cp_parser_sizeof_pack): Set it.
	* pt.c 	(tsubst_copy) [SIZEOF_EXPR]: Likewise.
	(tsubst_pack_expansion): Improve T... shortcut for expression packs.

From-SVN: r230629
2015-11-19 17:29:08 -05:00
Ryan Burn 0398c18360 re PR c++/68396 (function auto-deduced return types get incorrectly classified as parameter packs)
PR c++/68396

2015-11-19  Ryan Burn  <contact@rnburn.com>

	* pt.c (find_parameter_packs_r) [DECLTYPE_TYPE]: When traversing
	the DECLTYPE_TYPE_EXPR, set type_pack_expansion_p to false.

From-SVN: r230620
2015-11-19 13:25:38 -05:00
Jason Merrill cda0a029f4 Merge C++ delayed folding branch.
* call.c (build_conditional_expr_1, convert_like_real)
	(convert_arg_to_ellipsis, convert_for_arg_passing): Don't fold.
	(build_new_op_1, build_over_call, build_cxx_call): Fold for warnings.
	* class.c (build_base_path, determine_primary_bases)
	(update_vtable_entry_for_fn, check_bitfield_decl)
	(layout_nonempty_base_or_field, layout_empty_base)
	(propagate_binfo_offsets, include_empty_classes)
	(layout_class_type, build_vbase_offset_vtbl_entries): Use
	fold_convert.
	* constexpr.c (cxx_eval_builtin_function_call): Fold away the NOP_EXPR.
	(cxx_eval_call_expression): Handle MEM_REF.
	(cxx_eval_pointer_plus_expression): Fold the second operand.
	(cxx_eval_constant_expression): Handle MEM_REF, UNARY_PLUS_EXPR.
	(fold_simple_1, fold_simple): New.
	(maybe_constant_value_1): Factor out from maybe_constant_value.
	(cv_cache, maybe_constant_value): Cache results.
	(maybe_constant_init): Handle null input.
	(potential_constant_expression_1): Handle RESULT_DECL, EMPTY_CLASS_EXPR.
	* cp-array-notation.c (build_array_notation_ref): Fold operands.
	* cp-gimplify.c (cp_fold_r, cp_fold): New.
	(cp_genericize_r): Use fold_convert.  Don't fold SIZEOF_EXPR.
	(cp_genericize): Fold everything.
	(contains_label_1, contains_label_p): New.
	(cp_fold, cp_fully_fold): New.
	* cp-tree.h (class cache_map): New.
	* cvt.c (cp_convert_to_pointer, ocp_convert): Use convert_to_*_nofold.
	(cp_convert_and_check): Use cp_fully_fold.
	(convert, convert_force): Don't fold.
	* decl.c (fold_sizeof_expr): Change from fold_sizeof_expr_r.
	(compute_array_index_type): Use cp_fully_fold.
	(build_enumerator): Use fold_convert.
	* decl2.c (get_guard_cond, set_guard): Use fold_convert.
	* init.c (build_zero_init_1): Fold zero-initializers.
	(build_new_1): Fold nelts calculations.
	(build_vec_delete_1): Fold conversions.
	(build_vec_init): Fold maxindex.
	* parser.c (cp_parser_binary_expression): Fold LHS of || and &&.
	(cp_parser_question_colon_clause): Fold LHS.
	* pt.c (convert_nontype_argument): Fold nullptr conversion.
	* semantics.c (finish_unary_op_expr): Fold for warnings.
	(handle_omp_array_sections_1): Fold length and low bound.
	(handle_omp_for_class_iterator): Fold various things.
	* tree.c (builtin_valid_in_constant_expr_p): Add
	BUILT_IN_ATOMIC_ALWAYS_LOCK_FREE.
	(convert_bitfield_to_declared_type): Don't fold.
	(handle_init_priority_attribute): Fold.
	(fold_if_not_in_template): Remove.
	* typeck.c (decay_conversion, build_class_member_access_expr)
	(build_simple_component_ref, cp_build_array_ref, build_vec_cmp)
	(cp_pointer_int_sum, pointer_diff): Don't fold.
	(cp_build_binary_op): Fold for warnings and PMF ops.
	(cp_build_unary_op): Fold negation of a constant, nothing else.
	(expand_ptrmemfunc_cst): Fold operations.
	* typeck2.c (split_nonconstant_init): Fold initializer.
	(store_init_value): Likewise.
	(check_narrowing): Try folding.
	* config-lang.in (gtfiles): Add cp-gimplify.c.

From-SVN: r230365
2015-11-13 19:08:05 -05:00
James Norris 6e232ba424 c-pragma.c (oacc_pragmas): Add entry for declare directive.
2015-11-12  James Norris  <jnorris@codesourcery.com>
	    Joseph Myers  <joseph@codesourcery.com>

	gcc/c-family/
	* c-pragma.c (oacc_pragmas): Add entry for declare directive. 
	* c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_DECLARE.
	(enum pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_DEVICE_RESIDENT and
	PRAGMA_OACC_CLAUSE_LINK.

	gcc/c/
	* c-parser.c (c_parser_pragma): Handle PRAGMA_OACC_DECLARE.
	(c_parser_omp_clause_name): Handle 'device_resident' clause.
	(c_parser_oacc_data_clause): Handle PRAGMA_OACC_CLAUSE_DEVICE_RESIDENT
	and PRAGMA_OMP_CLAUSE_LINK.
	(c_parser_oacc_all_clauses): Handle PRAGMA_OACC_CLAUSE_DEVICE_RESIDENT
	and PRAGMA_OACC_CLAUSE_LINK.
	(OACC_DECLARE_CLAUSE_MASK): New definition.
	(c_parser_oacc_declare): New function.

	gcc/cp/
	* parser.c (cp_parser_omp_clause_name): Handle 'device_resident'
	clause.
	(cp_parser_oacc_data_clause): Handle PRAGMA_OACC_CLAUSE_DEVICE_RESIDENT
	and PRAGMA_OMP_CLAUSE_LINK.
	(cp_paser_oacc_all_clauses): Handle PRAGMA_OACC_CLAUSE_DEVICE_RESIDENT
	and PRAGMA_OMP_CLAUSE_LINK.
	(OACC_DECLARE_CLAUSE_MASK): New definition.
	(cp_parser_oacc_declare): New function.
	(cp_parser_pragma): Handle PRAGMA_OACC_DECLARE.
	* pt.c (tsubst_expr): Handle OACC_DECLARE.

	gcc/
	* gimple-pretty-print.c (dump_gimple_omp_target): Handle
	GF_OMP_TARGET_KIND_OACC_DECLARE. 
	* gimple.h (enum gf_mask): Add GF_OMP_TARGET_KIND_OACC_DECLARE.
	(is_gomple_omp_oacc): Handle GF_OMP_TARGET_KIND_OACC_DECLARE.
	* gimplify.c (oacc_declare_returns): New.
	(gimplify_bind_expr): Prepend 'exit' stmt to cleanup.
	(device_resident_p): New function.
	(oacc_default_clause): Handle device_resident clause.
	(gimplify_oacc_declare_1, gimplify_oacc_declare): New functions.
	(gimplify_expr): Handle OACC_DECLARE.
	* omp-builtins.def (BUILT_IN_GOACC_DECLARE): New builtin.
	* omp-low.c (expand_omp_target): Handle
	GF_OMP_TARGET_KIND_OACC_DECLARE and BUILTIN_GOACC_DECLARE.
	(build_omp_regions_1): Handlde GF_OMP_TARGET_KIND_OACC_DECLARE.
	(lower_omp_target): Handle GF_OMP_TARGET_KIND_OACC_DECLARE,
	GOMP_MAP_DEVICE_RESIDENT and GOMP_MAP_LINK.
	(make_gimple_omp_edges): Handle GF_OMP_TARGET_KIND_OACC_DECLARE.
	* tree-pretty-print.c (dump_omp_clause): Handle GOMP_MAP_LINK and
	GOMP_MAP_DEVICE_RESIDENT.

	gcc/testsuite
	* c-c++-common/goacc/declare-1.c: New test.
	* c-c++-common/goacc/declare-2.c: Likewise.

	include/
	* gomp-constants.h (enum gomp_map_kind): Add GOMP_MAP_DEVICE_RESIDENT
	and GOMP_MAP_LINK.

	libgomp/
	* libgomp.map (GOACC_2.0.1): Export GOACC_declare.
	* oacc-parallel.c (GOACC_declare): New function.
	* testsuite/libgomp.oacc-c-c++-common/declare-1.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/declare-2.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/declare-4.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/declare-5.c: Likewise.
	* testsuite/libgomp.oacc-c++/declare-1.C: Likewise.

Co-Authored-By: Joseph Myers <joseph@codesourcery.com>

From-SVN: r230275
2015-11-12 22:20:41 +00:00
Jason Merrill 84edfc8aef pt.c (check_explicit_specialization): Check the namespace after we choose a template.
* pt.c (check_explicit_specialization): Check the namespace after
	we choose a template.

From-SVN: r230271
2015-11-12 15:37:46 -05:00
Jason Merrill c7360ed2f9 pt.c (instantiate_class_template_1): Set function_depth around instantiation of lambda op().
* pt.c (instantiate_class_template_1): Set function_depth around
	instantiation of lambda op().

From-SVN: r230201
2015-11-11 19:53:19 -05:00
Andrew MacLeod 69f293c908 decl.c: Remove unused header files.
ada

	* gcc-interface/decl.c: Remove unused header files.
	* gcc-interface/misc.c: Likewise.
	* gcc-interface/targtyps.c: Likewise.
	* gcc-interface/trans.c: Likewise.
	* gcc-interface/utils.c: Likewise.
c

	* c-array-notation.c: Remove unused header files.
	* c-aux-info.c: Likewise.
	* c-convert.c: Likewise.
	* c-decl.c: Likewise.
	* c-errors.c: Likewise.
	* c-lang.c: Likewise.
	* c-objc-common.c: Likewise.
	* c-parser.c: Likewise.
	* c-typeck.c: Likewise.
	* gccspec.c: Likewise.

c-family

	* array-notation-common.c: Remove unused header files.
	* c-ada-spec.c: Likewise.
	* c-cilkplus.c: Likewise.
	* c-common.c: Likewise.
	* c-cppbuiltin.c: Likewise.
	* c-dump.c: Likewise.
	* c-format.c: Likewise.
	* c-gimplify.c: Likewise.
	* c-indentation.c: Likewise.
	* c-lex.c: Likewise.
	* c-omp.c: Likewise.
	* c-opts.c: Likewise.
	* c-pch.c: Likewise.
	* c-ppoutput.c: Likewise.
	* c-pragma.c: Likewise.
	* c-pretty-print.c: Likewise.
	* c-semantics.c: Likewise.
	* c-ubsan.c: Likewise.
	* cilk.c: Likewise.
	* stub-objc.c: Likewise.

cp

	* call.c: Remove unused header files.
	* class.c: Likewise.
	* constexpr.c: Likewise.
	* cp-array-notation.c: Likewise.
	* cp-cilkplus.c: Likewise.
	* cp-gimplify.c: Likewise.
	* cp-lang.c: Likewise.
	* cp-objcp-common.c: Likewise.
	* cp-ubsan.c: Likewise.
	* cvt.c: Likewise.
	* cxx-pretty-print.c: Likewise.
	* decl.c: Likewise.
	* decl2.c: Likewise.
	* dump.c: Likewise.
	* error.c: Likewise.
	* except.c: Likewise.
	* expr.c: Likewise.
	* friend.c: Likewise.
	* g++spec.c: Likewise.
	* init.c: Likewise.
	* lambda.c: Likewise.
	* lex.c: Likewise.
	* mangle.c: Likewise.
	* method.c: Likewise.
	* name-lookup.c: Likewise.
	* optimize.c: Likewise.
	* parser.c: Likewise.
	* pt.c: Likewise.
	* ptree.c: Likewise.
	* repo.c: Likewise.
	* rtti.c: Likewise.
	* search.c: Likewise.
	* semantics.c: Likewise.
	* tree.c: Likewise.
	* typeck.c: Likewise.
	* typeck2.c: Likewise.
	* vtable-class-hierarchy.c: Likewise.

Fortran

	* array.c: Remove unused header files.
	* convert.c: Likewise.
	* cpp.c: Likewise.
	* decl.c: Likewise.
	* f95-lang.c: Likewise.
	* frontend-passes.c: Likewise.
	* iresolve.c: Likewise.
	* match.c: Likewise.
	* module.c: Likewise.
	* options.c: Likewise.
	* parse.c: Likewise.
	* target-memory.c: Likewise.
	* trans-array.c: Likewise.
	* trans-common.c: Likewise.
	* trans-const.c: Likewise.
	* trans-decl.c: Likewise.
	* trans-expr.c: Likewise.
	* trans-intrinsic.c: Likewise.
	* trans-io.c: Likewise.
	* trans-openmp.c: Likewise.
	* trans-stmt.c: Likewise.
	* trans-types.c: Likewise.
	* trans.c: Likewise.

go

	* go-backend.c: Remove unused header files.
	* go-gcc.cc: Likewise.
	* go-lang.c: Likewise.
	* gospec.c: Likewise.

Java

	* boehm.c: Remove unused header files.
	* builtins.c: Likewise.
	* class.c: Likewise.
	* constants.c: Likewise.
	* decl.c: Likewise.
	* except.c: Likewise.
	* expr.c: Likewise.
	* java-gimplify.c: Likewise.
	* jcf-dump.c: Likewise.
	* jcf-io.c: Likewise.
	* jcf-parse.c: Likewise.
	* jvgenmain.c: Likewise.
	* lang.c: Likewise.
	* mangle.c: Likewise.
	* mangle_name.c: Likewise.
	* resource.c: Likewise.
	* typeck.c: Likewise.
	* verify-glue.c: Likewise.
	* verify-impl.c: Likewise.
	* zextract.c: Likewise.

jit

	* dummy-frontend.c: Remove unused header files.
	* jit-builtins.c: Likewise.
	* jit-playback.c: Likewise.
	* jit-recording.c: Likewise.
	* jit-spec.c: Likewise.
	* libgccjit.c: Likewise.

lto

	* lto-lang.c: Remove unused header files.
	* lto-object.c: Likewise.
	* lto-partition.c: Likewise.
	* lto-symtab.c: Likewise.
	* lto.c: Likewise.

objc

	* objc-act.c: Remove unused header files.
	* objc-encoding.c: Likewise.
	* objc-gnu-runtime-abi-01.c: Likewise.
	* objc-lang.c: Likewise.
	* objc-map.c: Likewise.
	* objc-next-runtime-abi-01.c: Likewise.
	* objc-next-runtime-abi-02.c: Likewise.
	* objc-runtime-shared-support.c: Likewise.

objcp

	* objcp-decl.c: Remove unused header files.
	* objcp-lang.c: Likewise.

From-SVN: r230166
2015-11-11 14:18:08 +00:00
Jason Merrill 9f46fa10f6 pt.c (push_inline_template_parms_recursive): Don't recreate the CONST_DECL.
* pt.c (push_inline_template_parms_recursive): Don't recreate the
	CONST_DECL.

From-SVN: r229856
2015-11-06 10:33:24 -05:00
Cesar Philippidis 7a5e4956cc gimplify.c (gimplify_scan_omp_clauses): Add support for OMP_CLAUSE_TILE.
gcc/
	* gimplify.c (gimplify_scan_omp_clauses): Add support for
	OMP_CLAUSE_TILE.  Update handling of OMP_CLAUSE_INDEPENDENT.
	(gimplify_adjust_omp_clauses): Likewise.
	* omp-low.c (scan_sharing_clauses): Add support for OMP_CLAUSE_TILE.
	* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_TILE.
	* tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_TILE.
	* tree.c (omp_clause_num_ops): Add an entry for OMP_CLAUSE_TILE.
	(omp_clause_code_name): Likewise.
	(walk_tree_1): Handle OMP_CLAUSE_TILE.
	* tree.h (OMP_TILE_LIST): New macro.

	gcc/c-family/
	* c-omp.c (c_oacc_split_loop_clauses): Make TILE, GANG, WORKER, VECTOR,
	AUTO, SEQ, INDEPENDENT and PRIVATE loop clauses.  Associate REDUCTION
	clauses with parallel and kernels and loops.
	* c-pragma.h (enum pragma_omp_clause): Add entries for
	PRAGMA_OACC_CLAUSE_{INDEPENDENT,TILE,DEFAULT}.
	* pt.c (tsubst_omp_clauses): Add support for OMP_CLAUSE_{NUM_GANGS,
	NUM_WORKERS,VECTOR_LENGTH,GANG,WORKER,VECTOR,ASYNC,WAIT,TILE,AUTO,
	INDEPENDENT,SEQ}. 
	(tsubst_expr): Add support for OMP_CLAUSE_{KERNELS,PARALLEL,LOOP}.

	gcc/c/
	* c-parser.c (c_parser_omp_clause_name): Add support for
	PRAGMA_OACC_CLAUSE_INDEPENDENT and PRAGMA_OACC_CLAUSE_TILE.
	(c_parser_omp_clause_default): Add is_oacc argument. Handle
	default(none) in OpenACC.
	(c_parser_oacc_shape_clause): Allow pointer variables as gang static
	arguments.
	(c_parser_oacc_clause_tile): New function.
	(c_parser_oacc_all_clauses): Add support for OMP_CLAUSE_DEFAULT,
	OMP_CLAUSE_INDEPENDENT and OMP_CLAUSE_TILE.
	(OACC_LOOP_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_{PRIVATE,INDEPENDENT,
	TILE}.
	(OACC_KERNELS_MASK): Add PRAGMA_OACC_CLAUSE_DEFAULT.
	(OACC_PARALLEL_MASK): Add PRAGMA_OACC_CLAUSE_{DEFAULT,PRIVATE,
	FIRSTPRIVATE}.
	(c_parser_omp_all_clauses): Update call to c_parser_omp_clause_default.
	(c_parser_oacc_update): Update the error message for missing clauses.
	* c-typeck.c (c_finish_omp_clauses): Add support for OMP_CLAUSE_TILE
	and OMP_CLAUSE_INDEPENDENT.

	gcc/cp/
	* parser.c (cp_parser_omp_clause_name): Add support for
	PRAGMA_OACC_CLAUSE_INDEPENDENT and PRAGMA_OACC_CLAUSE_TILE.
	(cp_parser_oacc_shape_clause): Allow pointer variables as gang static
	arguments.
	(cp_parser_oacc_clause_tile): New function.
	(cp_parser_omp_clause_default): Add is_oacc argument. Handle
	default(none) in OpenACC.
	(cp_parser_oacc_all_clauses): Add support for
	(cp_parser_omp_all_clauses): Update call to
	cp_parser_omp_clause_default.
	PRAGMA_OACC_CLAUSE_{DEFAULT,INDEPENDENT,TILE,PRIVATE,FIRSTPRIVATE}.
	(OACC_LOOP_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_{PRIVATE,INDEPENDENT,
	TILE}.
	(OACC_KERNELS_MASK): Add PRAGMA_OACC_CLAUSE_DEFAULT.
	(OACC_PARALLEL_MASK): Add PRAGMA_OACC_CLAUSE_{DEFAULT,PRIVATE,
	FIRSTPRIVATE}.
	(cp_parser_oacc_update): Update the error message for missing clauses.
	* semantics.c (finish_omp_clauses): Add support for
	OMP_CLAUSE_INDEPENDENT and OMP_CLAUSE_TILE.

	gcc/fortran/
	* openmp.c (gfc_match_omp_clauses): Update support for the tile
	and default clauses in OpenACC.
	(gfc_match_oacc_update): Error when data clauses are supplied.
	(oacc_compatible_clauses): Delete.
	(resolve_omp_clauses): Give special care for OpenACC reductions.
	Also update error reporting for the tile clause.
	(resolve_oacc_loop_blocks): Update error reporting for the tile clause.
	* trans-openmp.c (gfc_trans_omp_clauses): Update OMP_CLAUSE_SEQ. Add
	OMP_CLAUSE_{AUTO,TILE} and add support the the gang static argument.
	(gfc_trans_oacc_combined_directive): Update the list of clauses which
	are split to acc loops.

	gcc/testsuite/
	* c-c++-common/goacc/combined-directives.c: New test.
	* c-c++-common/goacc/loop-clauses.c: New test.
	* c-c++-common/goacc/tile.c: New test.
	* c-c++-common/goacc/loop-shape.c: Add test for pointer variable
	as gang static arguments.
	* c-c++-common/goacc/update-1.c: Adjust expected error message.
	* g++.dg/goacc/template.C: New test.
	* gfortran.dg/goacc/combined-directives.f90: New test.
	* gfortran.dg/goacc/default.f95: New test.
	* gfortran.dg/goacc/default_none.f95: New test.
	* gfortran.dg/goacc/firstprivate-1.f95: New test.
	* gfortran.dg/goacc/gang-static.f95: New test.
	* gfortran.dg/goacc/kernels-loop-inner.f95: New test.
	* gfortran.dg/goacc/kernels-loops-adjacent.f95: New test.
	* gfortran.dg/goacc/list.f95: Update test.
	* gfortran.dg/goacc/loop-2.f95: Likewise.
	* gfortran.dg/goacc/loop-4.f95: New test.
	* gfortran.dg/goacc/loop-5.f95: New test.
	* gfortran.dg/goacc/loop-6.f95: New test.
	* gfortran.dg/goacc/loop-tree-1.f90: Update test.
	* gfortran.dg/goacc/multi-clause.f90: New test.
	* gfortran.dg/goacc/parallel-tree.f95: Update test.
	* gfortran.dg/goacc/update.f95: New test.


Co-Authored-By: James Norris <jnorris@codesourcery.com>
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
Co-Authored-By: Tom de Vries <tom@codesourcery.com>

From-SVN: r229832
2015-11-05 18:03:48 -08:00
Jakub Jelinek e01d41e553 gcc/
2015-11-05  Jakub Jelinek  <jakub@redhat.com>
	    Ilya Verbin  <ilya.verbin@intel.com>

	* builtin-types.def
	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR): Remove.
	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_INT_INT): New.
	* cgraph.h (enum cgraph_simd_clone_arg_type): Add
	SIMD_CLONE_ARG_TYPE_LINEAR_REF_VARIABLE_STEP,
	SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_VARIABLE_STEP and
	SIMD_CLONE_ARG_TYPE_LINEAR_VAL_VARIABLE_STEP.
	(struct cgraph_simd_clone_arg): Adjust comment.
	* omp-builtins.def (BUILT_IN_GOMP_TARGET): Rename GOMP_target_41
	to GOMP_target_ext.  Add num_teams and thread_limit arguments.
	(BUILT_IN_GOMP_TARGET_DATA): Rename GOMP_target_data_41
	to GOMP_target_data_ext.
	(BUILT_IN_GOMP_TARGET_UPDATE): Rename GOMP_target_update_41
	to GOMP_target_update_ext.
	(BUILT_IN_GOMP_LOOP_NONMONOTONIC_DYNAMIC_START,
	BUILT_IN_GOMP_LOOP_NONMONOTONIC_GUIDED_START,
	BUILT_IN_GOMP_LOOP_NONMONOTONIC_DYNAMIC_NEXT,
	BUILT_IN_GOMP_LOOP_NONMONOTONIC_GUIDED_NEXT,
	BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_START,
	BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START,
	BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_NEXT,
	BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_NEXT,
	BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_DYNAMIC,
	BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_GUIDED): New built-ins.
	* tree-core.h (enum omp_clause_schedule_kind): Add
	OMP_CLAUSE_SCHEDULE_MASK, OMP_CLAUSE_SCHEDULE_MONOTONIC,
	OMP_CLAUSE_SCHEDULE_NONMONOTONIC and change
	OMP_CLAUSE_SCHEDULE_LAST value.
	* tree.def (OMP_SIMD, CILK_SIMD, CILK_FOR, OMP_DISTRIBUTE,
	OMP_TASKLOOP, OACC_LOOP): Add OMP_FOR_ORIG_DECLS argument.
	* tree.h (OMP_FOR_ORIG_DECLS): Use OMP_LOOP_CHECK instead of
	OMP_FOR_CHECK.  Remove comment.
	* tree-pretty-print.c (dump_omp_clause): Handle
	GOMP_MAP_FIRSTPRIVATE_REFERENCE and GOMP_MAP_ALWAYS_POINTER.
	Simplify.  Print schedule clause modifiers.
	* tree-vect-stmts.c (vectorizable_simd_clone_call): Add
	SIMD_CLONE_ARG_TYPE_LINEAR_{REF,VAL,UVAL}_VARIABLE_STEP
	cases.
	* gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP_ALWAYS_TO.
	(omp_default_clause): Tweak for
	private/firstprivate/is_device_ptr variables on target
	construct and use_device_ptr on target data.
	(omp_check_private): Likewise.
	(omp_notice_variable): For references check whether what it refers
	to has mappable type, rather than the reference itself.
	(omp_is_private): Diagnose linear iteration variables on non-simd
	constructs.
	(omp_no_lastprivate): Return true only for Fortran.
	(gimplify_scan_omp_clauses): Or in GOVD_MAP_ALWAYS_TO for
	GOMP_MAP_ALWAYS_TO or GOMP_MAP_ALWAYS_TOFROM kinds.
	Add support for GOMP_MAP_FIRSTPRIVATE_REFERENCE and
	GOMP_MAP_ALWAYS_POINTER, remove old handling of structure element
	based array sections.  Use GOMP_MAP_ALWAYS_P.  Fix up handling of
	lastprivate and linear when combined with distribute.  Gimplify
	variable low-bound for array reduction.  Look through
	POINTER_PLUS_EXPR when looking for ADDR_EXPR for array section
	reductions.
	(gimplify_adjust_omp_clauses_1): For implicit references to
	variables with reference type and when not ref to scalar or
	ref to pointer, map what they refer to using tofrom and
	use GOMP_MAP_FIRSTPRIVATE_REFERENCE for the reference.
	(gimplify_adjust_omp_clauses): Remove GOMP_MAP_ALWAYS_POINTER
	from target exit data.  Handle GOMP_MAP_FIRSTPRIVATE_REFERENCE.
	Drop OMP_CLAUSE_MAP_PRIVATE support.  Use GOMP_MAP_ALWAYS_P.
	Diagnose the same var on both firstprivate and lastprivate on
	distribute construct.
	(gimplify_omp_for): Fix up handling of predetermined
	lastprivate or linear iter vars when combined with distribute.
	(find_omp_teams, computable_teams_clause, optimize_target_teams): New
	functions.
	(gimplify_omp_workshare): Call optimize_target_teams.
	* omp-low.c (struct omp_region): Add sched_modifiers field.
	(struct omp_for_data): Likewise.
	(omp_any_child_fn_dumped): New variable.
	(extract_omp_for_data): Fill in sched_modifiers, and mask out
	OMP_CLAUSE_SCHEDULE_KIND bits outside of OMP_CLAUSE_SCHEDULE_MASK
	from sched_kind.
	(determine_parallel_type): Use only OMP_CLAUSE_SCHEDULE_MASK
	bits of OMP_CLAUSE_SCHED_KIND.
	(scan_sharing_clauses): Handle GOMP_MAP_FIRSTPRIVATE_REFERENCE,
	drop OMP_CLAUSE_MAP_PRIVATE support.  Look through POINTER_PLUS_EXPR
	for array section reductions.
	(add_taskreg_looptemp_clauses): Add one extra _looptemp_ clause even
	for distribute parallel for, if there are lastprivate clauses on the
	for.
	(lower_rec_input_clauses): Handle non-zero low-bound on array
	section reductions.
	(lower_reduction_clauses): Likewise.
	(lower_send_clauses): Look through POINTER_PLUS_EXPR
	for array section reductions.
	(expand_parallel_call): Use nonmonotonic entrypoints for
	nonmonotonic: dynamic/guided.
	(expand_omp_taskreg): Call assign_assembler_name_if_neeeded on
	child_fn if current_function_decl has assembler name set, but child_fn
	does not.  Dump the header and IL of the child function when not in SSA
	form.
	(expand_omp_target): Likewise.  Pass num_teams and thread_limit
	arguments to BUILT_IN_GOMP_TARGET.
	(expand_omp_for_static_nochunk, expand_omp_for_static_chunk):
	Initialize the extra _looptemp_ clause to fd->loop.n2.
	(expand_omp_for): Use nonmonotonic entrypoints for
	nonmonotonic: dynamic/guided.  Initialize region->sched_modifiers.
	(expand_omp): Clear omp_any_child_fn_dumped.  Dump function header
	again if we have dumped any child functions.
	(lower_omp_for_lastprivate): Determine the right count variable
	for distribute simd, or distribute parallel for{, simd}.
	(lower_omp_target): Handle GOMP_MAP_FIRSTPRIVATE_REFERENCE
	and GOMP_MAP_ALWAYS_POINTER.  Drop OMP_CLAUSE_MAP_PRIVATE
	support.
	(simd_clone_clauses_extract): Handle variable step
	for references and arguments passed by reference.
	(simd_clone_mangle): Mangle ref/uval/val variable steps.
	(simd_clone_adjust_argument_types): Handle
	SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_VARIABLE_STEP like
	SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP and
	SIMD_CLONE_ARG_TYPE_LINEAR_VAL_VARIABLE_STEP like
	SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP.
	(simd_clone_linear_addend): New function.
	(simd_clone_adjust): Handle variable step like similarly
	to constant step, use simd_clone_linear_addend to determine
	the actual step at runtime.
gcc/c-family/
2015-11-05  Jakub Jelinek  <jakub@redhat.com>

	* c-common.h (c_finish_omp_atomic): Add TEST argument.
	(c_omp_check_loop_iv, c_omp_check_loop_iv_exprs): New prototypes.
	* c-omp.c (c_finish_omp_atomic): Add TEST argument.  Don't call
	save_expr or create_tmp_var* if TEST is true.
	(c_finish_omp_for): Store OMP_FOR_ORIG_DECLS always.
	Don't call add_stmt here.
	(struct c_omp_check_loop_iv_data): New type.
	(c_omp_check_loop_iv_r, c_omp_check_loop_iv,
	c_omp_check_loop_iv_exprs): New functions.
	(c_omp_split_clauses): Adjust for lastprivate being allowed on
	distribute.
	(c_omp_declare_simd_clauses_to_numbers): Change
	OMP_CLAUSE_LINEAR_VARIABLE_STRIDE OMP_CLAUSE_LINEAR_STEP into numbers.
	(c_omp_declare_simd_clauses_to_decls): Similarly change those
	from numbers to PARM_DECLs.
gcc/c/
2015-11-05  Jakub Jelinek  <jakub@redhat.com>
	    Ilya Verbin  <ilya.verbin@intel.com>

	* c-parser.c: Include context.h and gimple-expr.h.
	(c_parser_omp_clause_schedule): Parse schedule modifiers, diagnose
	monotonic together with nonmonotonic.
	(c_parser_omp_for_loop): Call c_omp_check_loop_iv.  Call add_stmt here.
	(OMP_DISTRIBUTE_CLAUSE_MASK): Add lastprivate clause.
	(c_parser_omp_target_data, c_parser_omp_target_enter_data,
	c_parser_omp_target_exit_data): Allow GOMP_MAP_ALWAYS_POINTER.
	(c_parser_omp_target): Likewise.  Evaluate num_teams and thread_limit
	expressions on combined target teams before the target.
	(c_parser_omp_declare_target): If decl has "omp declare target" or
	"omp declare target link" attribute, and cgraph or varpool node already
	exists, then set corresponding flags.  Call c_finish_omp_clauses
	in the parenthesized extended-list syntax case.
	* c-decl.c (c_decl_attributes): Don't diagnose block scope vars inside
	declare target.
	* c-typeck.c (handle_omp_array_sections_1): Allow non-zero low-bound
	on OMP_CLAUSE_REDUCTION array sections.
	(handle_omp_array_sections): Encode low-bound into the MEM_REF, either
	into the constant offset, or for variable low-bound using
	POINTER_PLUS_EXPR.  For structure element based array sections use
	GOMP_MAP_ALWAYS_POINTER instead of GOMP_MAP_FIRSTPRIVATE_POINTER.
	(c_finish_omp_clauses): Drop generic_field_head, structure
	elements are now always mapped even as array section bases,
	diagnose same var in data sharing and mapping clauses.  Diagnose if
	linear step on declare simd is neither a constant nor a uniform
	parameter.  Look through POINTER_PLUS_EXPR for array section
	reductions.  Diagnose the same var or function appearing multiple
	times on the same directive.  Fix up wording for the to clause if t
	is neither a FUNCTION_DECL nor a VAR_DECL.  Diagnose nonmonotonic
	modifier on kinds other than dynamic or guided or nonmonotonic
	modifier together with ordered clause.
gcc/cp/
2015-11-05  Jakub Jelinek  <jakub@redhat.com>
	    Ilya Verbin  <ilya.verbin@intel.com>

	* cp-tree.h (finish_omp_for): Add ORIG_INITS argument.
	(omp_privatize_field): Add SHARED argument.
	* parser.c: Include context.h.
	(cp_parser_omp_clause_schedule): Parse schedule
	modifiers, diagnose monotonic together with nonmonotonic.
	(cp_parser_omp_clause_linear): Add DECLARE_SIMD argument.  Parse
	parameter name as linear step as id-expression rather than expression.
	(cp_parser_omp_all_clauses): Adjust caller.
	(cp_parser_omp_for_loop_init): Add ORIG_INIT argument,
	initialize it.  Adjust omp_privatize_field caller.
	(cp_parser_omp_for_loop): Compute orig_inits, pass it's address
	to finish_omp_for.
	(OMP_DISTRIBUTE_CLAUSE_MASK): Add lastprivate clause.
	(cp_parser_omp_target_data,
	cp_parser_omp_target_enter_data,
	cp_parser_omp_target_exit_data): Allow GOMP_MAP_ALWAYS_POINTER
	and GOMP_MAP_FIRSTPRIVATE_REFERENCE.
	(cp_parser_omp_target): Likewise.  Evaluate num_teams and
	thread_limit expressions on combined target teams before the target.
	(cp_parser_omp_declare_target): If decl has "omp declare target" or
	"omp declare target link" attribute, and cgraph or varpool node already
	exists, then set corresponding flags.  Call finish_omp_clauses
	in the parenthesized extended-list syntax case.  Call
	cp_parser_require_pragma_eol instead of cp_parser_skip_to_pragma_eol.
	(cp_parser_omp_end_declare_target): Call cp_parser_require_pragma_eol
	instead of cp_parser_skip_to_pragma_eol.
	* decl2.c (cplus_decl_attributes): Don't diagnose block scope vars inside
	declare target.
	* pt.c (tsubst_omp_clauses): If OMP_CLAUSE_LINEAR_VARIABLE_STRIDE,
	use tsubst_omp_clause_decl instead of tsubst_expr on
	OMP_CLAUSE_LINEAR_STEP.  Handle non-static data members in shared
	clauses.
	(tsubst_omp_for_iterator): Adjust omp_privatize_field caller.
	(tsubst_find_omp_teams): New function.
	(tsubst_expr): Evaluate num_teams and thread_limit expressions on
	combined target teams before the target.  Use OMP_FOR_ORIG_DECLS for
	all OpenMP/OpenACC/Cilk+ looping constructs.  Adjust finish_omp_for
	caller.
	* semantics.c (omp_privatize_field): Add SHARED argument, if true,
	always create artificial var and never put it into the hash table
	or vector.
	(handle_omp_array_sections_1): Adjust omp_privatize_field caller.
	Allow non-zero low-bound on OMP_CLAUSE_REDUCTION array sections.
	(handle_omp_array_sections): For structure element
	based array sections use GOMP_MAP_ALWAYS_POINTER instead of
	GOMP_MAP_FIRSTPRIVATE_POINTER.  Encode low-bound into the MEM_REF,
	either into the constant offset, or for variable low-bound using
	POINTER_PLUS_EXPR.
	(finish_omp_clauses): Adjust omp_privatize_field caller.  Drop
	generic_field_head, structure elements are now always mapped even
	as array section bases, diagnose same var in data sharing and
	mapping clauses.  For references map what they refer to using
	GOMP_MAP_ALWAYS_POINTER for structure elements and
	GOMP_MAP_FIRSTPRIVATE_REFERENCE otherwise.  Diagnose if linear step
	on declare simd is neither a constant nor a uniform parameter.
	Allow non-static data members on shared clauses.  Look through
	POINTER_PLUS_EXPR for array section reductions.  Diagnose nonmonotonic
	modifier on kinds other than dynamic or guided or nonmonotonic
	modifier together with ordered clause.  Diagnose the same var or
	function appearing multiple times on the same directive.  Fix up
	wording for the to clause if t is neither a FUNCTION_DECL nor a
	VAR_DECL, use special wording for OVERLOADs and TEMPLATE_ID_EXPR.
	(handle_omp_for_class_iterator): Add ORIG_DECLS argument.  Call
	c_omp_check_loop_iv_exprs on cond.
	(finish_omp_for): Add ORIG_INITS argument.  Call
	c_omp_check_loop_iv_exprs on ORIG_INITS elements.  Adjust
	handle_omp_for_class_iterator caller.  Call c_omp_check_loop_iv.
	Call add_stmt.
	(finish_omp_atomic): Adjust c_finish_omp_atomic caller.
gcc/fortran/
2015-11-05  Jakub Jelinek  <jakub@redhat.com>

	* types.def (BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR): Remove.
	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_INT_INT): New.
gcc/testsuite/
2015-11-05  Jakub Jelinek  <jakub@redhat.com>

	* c-c++-common/gomp/clauses-2.c (foo): Adjust for diagnostics
	of variables in both data sharing and mapping clauses and for
	structure element based array sections being mapped rather than
	privatized.
	* c-c++-common/gomp/declare-target-2.c: Add various new tests.  Adjust
	expected diagnostics wording in one case.
	* c-c++-common/gomp/distribute-1.c: New test.
	* c-c++-common/gomp/element-1.c: New test.
	* c-c++-common/gomp/pr61486-2.c: Add #pragma omp declare target
	and #pragma omp end declare target pair around the function.
	Change s from a parameter to a file scope variable.
	* c-c++-common/gomp/pr67521.c: Add dg-error directives.
	* c-c++-common/gomp/reduction-1.c (foo): Don't expect diagnostics
	on non-zero low-bound in reduction array sections.  Add further
	tests.
	* c-c++-common/gomp/schedule-modifiers-1.c: New test.
	* c-c++-common/gomp/target-teams-1.c: New test.
	* gcc.dg/gomp/declare-simd-1.c: Add scan-assembler-times directives
	for expected mangling on x86_64/i?86.
	* gcc.dg/gomp/declare-simd-3.c: New test.
	* gcc.dg/gomp/declare-simd-4.c: New test.
	* gcc.dg/gomp/for-20.c: New test.
	* gcc.dg/gomp/for-21.c: New test.
	* gcc.dg/gomp/for-22.c: New test.
	* gcc.dg/gomp/for-23.c: New test.
	* gcc.dg/gomp/for-24.c: New test.
	* gcc.dg/gomp/linear-1.c: New test.
	* gcc.dg/gomp/loop-1.c: New test.
	* g++.dg/gomp/atomic-17.C: New test.
	* g++.dg/gomp/clause-1.C (T::test): Don't expect error on
	non-static data member in shared clause.  Add single construct.
	* g++.dg/gomp/declare-simd-1.C: Add dg-options.  Add
	scan-assembler-times directives for expected mangling on x86_64/i?86.
	* g++.dg/gomp/declare-simd-3.C: Likewise.
	* g++.dg/gomp/declare-simd-4.C: New test.
	* g++.dg/gomp/declare-simd-5.C: New test.
	* g++.dg/gomp/declare-target-1.C: New test.
	* g++.dg/gomp/linear-2.C: New test.
	* g++.dg/gomp/loop-1.C: New test.
	* g++.dg/gomp/loop-2.C: New test.
	* g++.dg/gomp/loop-3.C: New test.
	* g++.dg/gomp/member-2.C (B::m2, B::m4): Don't expect error on
	non-static data member in shared clause.
	* g++.dg/gomp/member-3.C: New test.
	* g++.dg/gomp/member-4.C: New test.
	* g++.dg/gomp/pr38639.C (foo): Adjust dg-error.
	(bar): Remove dg-message.
	* g++.dg/gomp/target-teams-1.C: New test.
include/
2015-11-05  Jakub Jelinek  <jakub@redhat.com>
	    Ilya Verbin  <ilya.verbin@intel.com>

	* gomp-constants.h (GOMP_MAP_FLAG_SPECIAL_2): Define.
	(GOMP_MAP_FLAG_ALWAYS): Remove.
	(enum gomp_map_kind): Use GOMP_MAP_FLAG_SPECIAL_2 instead of
	GOMP_MAP_FLAG_ALWAYS for GOMP_MAP_ALWAYS_TO, GOMP_MAP_ALWAYS_FROM,
	GOMP_MAP_ALWAYS_TOFROM, GOMP_MAP_STRUCT, GOMP_MAP_RELEASE.
	Add GOMP_MAP_ALWAYS_POINTER and GOMP_MAP_FIRSTPRIVATE_REFERENCE.
	(GOMP_MAP_ALWAYS_P): Define.
	(GOMP_TARGET_FLAG_NOWAIT): Adjust comment.
libgomp/
2015-11-05  Jakub Jelinek  <jakub@redhat.com>
	    Ilya Verbin  <ilya.verbin@intel.com>

	* libgomp_g.h (GOMP_loop_nonmonotonic_dynamic_next,
	GOMP_loop_nonmonotonic_dynamic_start,
	GOMP_loop_nonmonotonic_guided_next,
	GOMP_loop_nonmonotonic_guided_start,
	GOMP_loop_ull_nonmonotonic_dynamic_next,
	GOMP_loop_ull_nonmonotonic_dynamic_start,
	GOMP_loop_ull_nonmonotonic_guided_next,
	GOMP_loop_ull_nonmonotonic_guided_start,
	GOMP_parallel_loop_nonmonotonic_dynamic,
	GOMP_parallel_loop_nonmonotonic_guided): New prototypes.
	(GOMP_target_41): Renamed to ...
	(GOMP_target_ext): ... this.  Add num_teams and thread_limit
	arguments.
	(GOMP_target_data_41): Renamed to ...
	(GOMP_target_data_ext): ... this.
	(GOMP_target_update_41): Renamed to ...
	(GOMP_target_update_ext): ... this.
	* libgomp.map (GOMP_4.5): Export GOMP_target_ext,
	GOMP_target_data_ext and GOMP_target_update_ext instead of
	GOMP_target_41, GOMP_target_data_41 and GOMP_target_update_41.
	Export GOMP_loop_nonmonotonic_dynamic_next,
	GOMP_loop_nonmonotonic_dynamic_start,
	GOMP_loop_nonmonotonic_guided_next,
	GOMP_loop_nonmonotonic_guided_start,
	GOMP_loop_ull_nonmonotonic_dynamic_next,
	GOMP_loop_ull_nonmonotonic_dynamic_start,
	GOMP_loop_ull_nonmonotonic_guided_next,
	GOMP_loop_ull_nonmonotonic_guided_start,
	GOMP_parallel_loop_nonmonotonic_dynamic and
	GOMP_parallel_loop_nonmonotonic_guided.
	* loop.c (GOMP_parallel_loop_nonmonotonic_dynamic,
	GOMP_parallel_loop_nonmonotonic_guided,
	GOMP_loop_nonmonotonic_dynamic_start,
	GOMP_loop_nonmonotonic_guided_start,
	GOMP_loop_nonmonotonic_dynamic_next,
	GOMP_loop_nonmonotonic_guided_next): New aliases or functions.
	* loop_ull.c (GOMP_loop_ull_nonmonotonic_dynamic_start,
	GOMP_loop_ull_nonmonotonic_guided_start,
	GOMP_loop_ull_nonmonotonic_dynamic_next,
	GOMP_loop_ull_nonmonotonic_guided_next): Likewise.
	* target.c (gomp_map_0len_lookup, gomp_map_val): New inline
	functions.
	(gomp_map_vars): Handle GOMP_MAP_ALWAYS_POINTER.  For
	GOMP_MAP_ZERO_LEN_ARRAY_SECTION use gomp_map_0len_lookup.
	Use gomp_map_val function.
	(gomp_target_fallback_firstprivate): New static function.
	(GOMP_target_41): Renamed to ...
	(GOMP_target_ext): ... this.  Add num_teams and thread_limit
	arguments.  Move firstprivate fallback handling into a new
	function.
	(GOMP_target_data_41): Renamed to ...
	(GOMP_target_data_ext): ... this.
	(GOMP_target_update_41): Renamed to ...
	(GOMP_target_update_ext): ... this.
	(gomp_exit_data): For GOMP_MAP_*ZERO_LEN* use
	gomp_map_0len_lookup instead of gomp_map_lookup.
	(omp_target_is_present): Use gomp_map_0len_lookup instead of
	gomp_map_lookup.
	* testsuite/libgomp.c/target-28.c: Likewise.
	* testsuite/libgomp.c/monotonic-1.c: New test.
	* testsuite/libgomp.c/monotonic-2.c: New test.
	* testsuite/libgomp.c/nonmonotonic-1.c: New test.
	* testsuite/libgomp.c/nonmonotonic-2.c: New test.
	* testsuite/libgomp.c/pr66199-5.c: New test.
	* testsuite/libgomp.c/pr66199-6.c: New test.
	* testsuite/libgomp.c/pr66199-7.c: New test.
	* testsuite/libgomp.c/pr66199-8.c: New test.
	* testsuite/libgomp.c/pr66199-9.c: New test.
	* testsuite/libgomp.c/reduction-11.c: New test.
	* testsuite/libgomp.c/reduction-12.c: New test.
	* testsuite/libgomp.c/reduction-13.c: New test.
	* testsuite/libgomp.c/reduction-14.c: New test.
	* testsuite/libgomp.c/reduction-15.c: New test.
	* testsuite/libgomp.c/target-12.c (main): Adjust for
	omp_target_is_present change for one-past-last element.
	* testsuite/libgomp.c/target-17.c (foo): Drop tests where
	the same var is both mapped and privatized.
	* testsuite/libgomp.c/target-19.c (foo): Adjust for different
	handling of zero-length array sections.
	* testsuite/libgomp.c/target-28.c: New test.
	* testsuite/libgomp.c/target-29.c: New test.
	* testsuite/libgomp.c/target-30.c: New test.
	* testsuite/libgomp.c/target-teams-1.c: New test.
	* testsuite/libgomp.c++/member-6.C: New test.
	* testsuite/libgomp.c++/member-7.C: New test.
	* testsuite/libgomp.c++/monotonic-1.C: New test.
	* testsuite/libgomp.c++/monotonic-2.C: New test.
	* testsuite/libgomp.c++/nonmonotonic-1.C: New test.
	* testsuite/libgomp.c++/nonmonotonic-2.C: New test.
	* testsuite/libgomp.c++/pr66199-3.C: New test.
	* testsuite/libgomp.c++/pr66199-4.C: New test.
	* testsuite/libgomp.c++/pr66199-5.C: New test.
	* testsuite/libgomp.c++/pr66199-6.C: New test.
	* testsuite/libgomp.c++/pr66199-7.C: New test.
	* testsuite/libgomp.c++/pr66199-8.C: New test.
	* testsuite/libgomp.c++/pr66199-9.C: New test.
	* testsuite/libgomp.c++/reduction-11.C: New test.
	* testsuite/libgomp.c++/reduction-12.C: New test.
	* testsuite/libgomp.c++/target-13.C: New test.
	* testsuite/libgomp.c++/target-14.C: New test.
	* testsuite/libgomp.c++/target-15.C: New test.
	* testsuite/libgomp.c++/target-16.C: New test.
	* testsuite/libgomp.c++/target-17.C: New test.
	* testsuite/libgomp.c++/target-18.C: New test.
	* testsuite/libgomp.c++/target-19.C: New test.

Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com>

From-SVN: r229814
2015-11-05 16:08:08 +01:00
Mikhail Maltsev 595278beb1 ENABLE_CHECKING refactoring: C family front ends
gcc/c-family/

	* c-omp.c (c_omp_split_clauses): Remove conditional compilation. Use
	flag_checking.

gcc/cp/

	* call.c (validate_conversion_obstack): Define unconditionally.
	* constexpr.c (maybe_constant_value, fold_non_dependent_expr): Use
	gcc_checking_assert.
	* cp-tree.h: Use CHECKING_P instead of ENABLE_CHECKING.
	* decl2.c (cxx_post_compilation_parsing_cleanups): Use flag_checking.
	* mangle.c (add_substitution): Likewise.
	* method.c (maybe_explain_implicit_delete): Likewise.
	* parser.c (cp_parser_template_argument_list): Remove conditional
	compilation.
	* pt.c (check_unstripped_args): Rename to...
	(verify_unstripped_args): ... this and remove conditional compilation.
	(retrieve_specialization): Guard call of verify_unstripped_args with
	flag_checking.
	(template_parm_to_arg): Remove conditional compilation.
	(template_parms_to_args, coerce_template_parameter_pack,
	coerce_template_parms): Likewise.
	(tsubst_copy): Use flag_checking.
	(type_unification_real): Remove conditional compilation.
	(build_non_dependent_expr): Use flag_checking.
	* tree.c (build_target_expr): Remove conditional compilation, use
	gcc_checking_assert.
	* typeck.c (comptypes): Likewise.
	* typeck2.c (digest_init_r): Likewise.

From-SVN: r229756
2015-11-04 14:32:42 +00:00
Jason Merrill bfb014c3de Handle auto parameter packs.
* pt.c (struct find_parameter_pack_data): Add
	type_pack_expansion_p field.
	(find_parameter_packs_r): Use it to turn 'auto' into a parameter pack.
	(uses_parameter_packs, make_pack_expansion)
	(check_for_bare_parameter_packs, fixed_parameter_pack_p): Set it.

From-SVN: r229722
2015-11-03 15:51:41 -05:00
Jason Merrill 4fea442db7 Implement multiple 'auto' feature from Concepts TS.
* parser.c (cp_parser_type_id_1): Allow 'auto' if -fconcepts.
	(cp_parser_template_type_arg): Likewise.
	(get_concept_from_constraint): Split out most logic to...
	* constraint.cc (placeholder_extract_concept_and_args): ...here.
	(equivalent_placeholder_constraints, hash_placeholder_constraint): New.
	* cxx-pretty-print.c (pp_cxx_constrained_type_spec): New.
	* cxx-pretty-print.h: Declare it.
	* error.c (dump_type) [TEMPLATE_TYPE_PARM]: Call it.
	* pt.c (is_auto_r, extract_autos_r, extract_autos, auto_hash): New.
	(type_uses_auto): Use is_auto_r.
	(do_auto_deduction): Handle multiple 'auto's if -fconcepts.
	* typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Compare
	constraints.

From-SVN: r229629
2015-10-31 12:20:05 -04:00
Jason Merrill a459b07fa4 Streamline for_each_template_parm.
* pt.c (for_each_template_parm_r): Use WALK_SUBTREE.
	Return a meaningful value rather than error_mark_node.
	(for_each_template_parm): Return a tree.
	(uses_template_parms_level): Return bool.
	* cp-tree.h: Adjust.

From-SVN: r229628
2015-10-31 12:19:55 -04:00
Jason Merrill 09833a1db1 Improve deduction failure diagnostics.
* pt.c (unify): Don't diagnose no common base if we already have
	the same template.
	(do_auto_deduction): Explain deduction failure.

From-SVN: r229627
2015-10-31 12:19:50 -04:00
Jason Merrill 79d9b2dea2 pt.c (hash_tmpl_and_args): Use iterative_hash_object on template uid.
* pt.c (hash_tmpl_and_args): Use iterative_hash_object on template
	uid.

From-SVN: r229626
2015-10-31 12:19:44 -04:00
Andrew MacLeod 2adfab879c decl.c: Reorder #include's and remove duplicates.
ada
2015-10-29  Andrew MacLeod  <amacleod@redhat.com>

	* gcc-interface/decl.c: Reorder #include's and remove duplicates.
	* gcc-interface/misc.c: Likewise.
	* gcc-interface/targtyps.c: Likewise.
	* gcc-interface/trans.c: Likewise.
	* gcc-interface/utils.c: Likewise.
	
c
2015-10-29  Andrew MacLeod  <amacleod@redhat.com>

	* c-array-notation.c: Reorder #include's and remove duplicates.
	* c-aux-info.c: Likewise.
	* c-convert.c: Likewise.
	* c-decl.c: Likewise.
	* c-errors.c: Likewise.
	* c-lang.c: Likewise.
	* c-objc-common.c: Likewise.
	* c-parser.c: Likewise.
	* c-typeck.c: Likewise.

c-family
2015-10-29  Andrew MacLeod  <amacleod@redhat.com>

	* array-notation-common.c: Reorder #include's and remove duplicates.
	* c-ada-spec.c: Likewise.
	* c-cilkplus.c: Likewise.
	* c-common.c: Likewise.
	* c-cppbuiltin.c: Likewise.
	* c-dump.c: Likewise.
	* c-format.c: Likewise.
	* c-gimplify.c: Likewise.
	* c-indentation.c: Likewise.
	* c-lex.c: Likewise.
	* c-omp.c: Likewise.
	* c-opts.c: Likewise.
	* c-pch.c: Likewise.
	* c-ppoutput.c: Likewise.
	* c-pragma.c: Likewise.
	* c-pretty-print.c: Likewise.
	* c-semantics.c: Likewise.
	* c-ubsan.c: Likewise.
	* cilk.c: Likewise.
	* stub-objc.c: Likewise.

cp
2015-10-29  Andrew MacLeod  <amacleod@redhat.com>

	* call.c: Reorder #include's and remove duplicates.
	* class.c: Likewise.
	* constexpr.c: Likewise.
	* cp-array-notation.c: Likewise.
	* cp-cilkplus.c: Likewise.
	* cp-gimplify.c: Likewise.
	* cp-lang.c: Likewise.
	* cp-objcp-common.c: Likewise.
	* cp-ubsan.c: Likewise.
	* cvt.c: Likewise.
	* cxx-pretty-print.c: Likewise.
	* decl.c: Likewise.
	* decl2.c: Likewise.
	* dump.c: Likewise.
	* error.c: Likewise.
	* except.c: Likewise.
	* expr.c: Likewise.
	* friend.c: Likewise.
	* init.c: Likewise.
	* lambda.c: Likewise.
	* lex.c: Likewise.
	* mangle.c: Likewise.
	* method.c: Likewise.
	* name-lookup.c: Likewise.
	* optimize.c: Likewise.
	* parser.c: Likewise.
	* pt.c: Likewise.
	* ptree.c: Likewise.
	* repo.c: Likewise.
	* rtti.c: Likewise.
	* search.c: Likewise.
	* semantics.c: Likewise.
	* tree.c: Likewise.
	* typeck.c: Likewise.
	* typeck2.c: Likewise.
	* vtable-class-hierarchy.c: Likewise.

fortran

2015-10-29  Andrew MacLeod  <amacleod@redhat.com>

	* array.c: Reorder #include's and remove duplicates.
	* convert.c: Likewise.
	* cpp.c: Likewise.
	* decl.c: Likewise.
	* f95-lang.c: Likewise.
	* frontend-passes.c: Likewise.
	* iresolve.c: Likewise.
	* match.c: Likewise.
	* module.c: Likewise.
	* options.c: Likewise.
	* parse.c: Likewise.
	* resolve.c: Likewise.
	* simplify.c: Likewise.
	* target-memory.c: Likewise.
	* trans-array.c: Likewise.
	* trans-common.c: Likewise.
	* trans-const.c: Likewise.
	* trans-decl.c: Likewise.
	* trans-expr.c: Likewise.
	* trans-intrinsic.c: Likewise.
	* trans-io.c: Likewise.
	* trans-openmp.c: Likewise.
	* trans-stmt.c: Likewise.
	* trans-types.c: Likewise.
	* trans.c: Likewise.

go
2015-10-29  Andrew MacLeod  <amacleod@redhat.com>

	* go-backend.c: Reorder #include's and remove duplicates.
	* go-lang.c: Likewise.

java
2015-10-29  Andrew MacLeod  <amacleod@redhat.com>

	* boehm.c: Reorder #include's and remove duplicates.
	* builtins.c: Likewise.
	* class.c: Likewise.
	* constants.c: Likewise.
	* decl.c: Likewise.
	* except.c: Likewise.
	* expr.c: Likewise.
	* java-gimplify.c: Likewise.
	* jcf-dump.c: Likewise.
	* jcf-io.c: Likewise.
	* jcf-parse.c: Likewise.
	* jvgenmain.c: Likewise.
	* lang.c: Likewise.
	* mangle.c: Likewise.
	* mangle_name.c: Likewise.
	* resource.c: Likewise.
	* typeck.c: Likewise.
	* verify-glue.c: Likewise.
	* verify-impl.c: Likewise.

jit
2015-10-29  Andrew MacLeod  <amacleod@redhat.com>

	* dummy-frontend.c: Reorder #include's and remove duplicates.
	* jit-builtins.c: Likewise.
	* jit-playback.c: Likewise.
	* jit-recording.c: Likewise.
	* libgccjit.c: Likewise.

lto
2015-10-29  Andrew MacLeod  <amacleod@redhat.com>

	* lto-lang.c: Reorder #include's and remove duplicates.
	* lto-object.c: Likewise.
	* lto-partition.c: Likewise.
	* lto-symtab.c: Likewise.
	* lto.c: Likewise.

objc
2015-10-29  Andrew MacLeod  <amacleod@redhat.com>

	* objc-lang.c: Reorder #include's and remove duplicates.
	* objc-map.c: Likewise.

objcp
2015-10-29  Andrew MacLeod  <amacleod@redhat.com>

	* objcp-decl.c: Reorder #include's and remove duplicates.
	* objcp-lang.c: Likewise.

From-SVN: r229533
2015-10-29 15:27:20 +00:00
Jason Merrill 6337bd75e2 DR 2179
DR 2179
	* pt.c (process_partial_specialization): Handle error_mark_node
	from most_specialized_partial_spec.

From-SVN: r229395
2015-10-26 17:17:50 -04:00
Jason Merrill ba2b189e84 call.c (add_template_conv_candidate): Pass DEDUCE_CALL.
* call.c (add_template_conv_candidate): Pass DEDUCE_CALL.
	(add_template_candidate_real): Handle it.
	(fn_type_unification): Handle it.

From-SVN: r229210
2015-10-22 20:51:14 -04:00
Jason Merrill 2a9fb7125e Implement N4268, Do constant evaluation of all non-type template args.
gcc/c-family/
	* c-cppbuiltin.c (c_cpp_builtins): Define
	__cpp_nontype_template_args.
gcc/cp/
	* parser.c (cp_parser_template_argument): For C++1z just parse a
	constant-expression.
	* pt.c (convert_nontype_argument): For C++1z always call
	maybe_constant_value.

From-SVN: r229019
2015-10-19 22:48:51 -04:00
Jakub Jelinek d9a6bd32ad builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, [...]): New.
gcc/
2015-10-13  Jakub Jelinek  <jakub@redhat.com>
	    Aldy Hernandez  <aldyh@redhat.com>
	    Ilya Verbin  <ilya.verbin@intel.com>

	* builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR,
	BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR,
	BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR,
	BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR,
	BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR,
	BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR,
	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT,
	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG,
	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL,
	BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New.
	(BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR,
	BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR,
	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove.
	* cgraph.h (enum cgraph_simd_clone_arg_type): Add
	SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP,
	SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP and
	SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP.
	(struct cgraph_simd_clone_arg): Adjust comment.
	* coretypes.h (struct gomp_ordered): New forward decl.
	* gimple.c (gimple_build_omp_critical): Add CLAUSES argument,
	set critical clauses to it.
	(gimple_build_omp_ordered): Return gomp_ordered * instead of
	gimple *.  Add CLAUSES argument, set ordered clauses to it.
	(gimple_copy): Unshare clauses on GIMPLE_OMP_CRITICAL and
	GIMPLE_OMP_ORDERED.
	* gimple.def (GIMPLE_OMP_ORDERED): Change from GSS_OMP to
	GSS_OMP_SINGLE_LAYOUT, move it after GIMPLE_OMP_TEAMS.
	* gimple.h (enum gf_mask): Add GF_OMP_TASK_TASKLOOP.  Add another bit
	to GF_OMP_FOR_KIND_MASK mask. Add GF_OMP_FOR_KIND_TASKLOOP, renumber
	GF_OMP_FOR_KIND_CILKFOR and GF_OMP_FOR_KIND_OACC_LOOP.  Adjust
	GF_OMP_FOR_SIMD, GF_OMP_FOR_COMBINED and GF_OMP_FOR_COMBINED_INTO.
	Add another bit to GF_OMP_TARGET_KIND_MASK mask.  Add
	GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA,
	renumber
	GF_OMP_TARGET_KIND_OACC_{PARALLEL,KERNELS,DATA,UPDATE,ENTER_EXIT_DATA}.
	(gomp_critical): Add clauses field.
	(gomp_ordered): New struct.
	(is_a_helper <gomp_ordered *>::test): New inline.
	(gimple_build_omp_critical): Add CLAUSES argument.
	(gimple_build_omp_ordered): Likewise.  Return gomp_ordered *
	instead of gimple *.
	(gimple_omp_critical_clauses, gimple_omp_critical_clauses_ptr,
	gimple_omp_critical_set_clauses, gimple_omp_ordered_clauses,
	gimple_omp_ordered_clauses_ptr, gimple_omp_ordered_set_clauses,
	gimple_omp_task_taskloop_p, gimple_omp_task_set_taskloop_p): New
	inline functions.
	* gimple-pretty-print.c (dump_gimple_omp_for): Handle taskloop.
	(dump_gimple_omp_target): Handle enter data and exit data.
	(dump_gimple_omp_block): Don't handle GIMPLE_OMP_ORDERED here.
	(dump_gimple_omp_critical): Print clauses.
	(dump_gimple_omp_ordered): New function.
	(dump_gimple_omp_task): Handle taskloop.
	(pp_gimple_stmt_1): Use dump_gimple_omp_ordered for
	GIMPLE_OMP_ORDERED.
	* gimple-walk.c (walk_gimple_op): Walk clauses on
	GIMPLE_OMP_CRITICAL and GIMPLE_OMP_ORDERED.
	* gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP_0LEN_ARRAY.
	(enum omp_region_type): Add ORT_COMBINED_TARGET and ORT_NONE.
	(struct gimplify_omp_ctx): Add loop_iter_var,
	target_map_scalars_firstprivate, target_map_pointers_as_0len_arrays
	and target_firstprivatize_array_bases fields.
	(delete_omp_context): Release loop_iter_var.
	(gimplify_bind_expr): Handle ORT_NONE.
	(maybe_fold_stmt): Adjust check for ORT_TARGET for the addition of
	ORT_COMBINED_TARGET.
	(is_gimple_stmt): Return true for OMP_TASKLOOP, OMP_TEAMS and
	OMP_TARGET{,_DATA,_UPDATE,_ENTER_DATA,_EXIT_DATA}.
	(omp_firstprivatize_variable): Handle ORT_NONE.  Adjust check for
	ORT_TARGET for the addition of ORT_COMBINED_TARGET.  Handle
	ctx->target_map_scalars_firstprivate.
	(omp_add_variable): Handle ORT_NONE.  Allow map clause together with
	data sharing clauses.  For data sharing clause with VLA decl
	on omp target/target data don't add firstprivate for the pointer.
	Call omp_notice_variable on TYPE_SIZE_UNIT only if it is a DECL_P.
	(omp_notice_threadprivate_variable): Adjust check for ORT_TARGET for
	the addition of ORT_COMBINED_TARGET.
	(omp_notice_variable): Handle ORT_NONE.  Adjust check for ORT_TARGET
	for the addition of ORT_COMBINED_TARGET.  Handle implicit mapping of
	pointers as zero length array sections and
	ctx->target_map_scalars_firstprivate mapping of scalars as firstprivate
	data sharing.
	(omp_check_private): Handle omp_member_access_dummy_var vars.
	(find_decl_expr): New function.
	(gimplify_scan_omp_clauses): Add CODE argument.  For OMP_CLAUSE_IF
	complain if OMP_CLAUSE_IF_MODIFIER is present and does not match code.
	Handle OMP_CLAUSE_GANG separately.  Handle
	OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN}
	clauses.  Diagnose linear clause on combined
	distribute {, parallel for} simd construct, unless it is the loop
	iterator.  Handle struct element GOMP_MAP_FIRSTPRIVATE_POINTER.
	Handle map clauses with COMPONENT_REF.  Initialize
	ctx->target_map_scalars_firstprivate,
	ctx->target_firstprivatize_array_bases and
	ctx->target_map_pointers_as_0len_arrays.  Add firstprivate for
	linear clause even to target region if combined.  Remove
	map clauses with GOMP_MAP_FIRSTPRIVATE_POINTER kind from
	OMP_TARGET_{,ENTER_,EXIT_}DATA.  For GOMP_MAP_FIRSTPRIVATE_POINTER
	map kind with non-INTEGER_CST OMP_CLAUSE_SIZE firstprivatize the bias.
	Handle OMP_CLAUSE_DEPEND_{SINK,SOURCE}.  Handle
	OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}.
	For linear clause on worksharing loop combined with parallel add
	shared clause on the parallel.  Handle OMP_CLAUSE_REDUCTION
	with MEM_REF OMP_CLAUSE_DECL.  Set DECL_NAME on
	omp_member_access_dummy_var vars.  Add lastprivate clause to outer
	taskloop if needed.
	(gimplify_adjust_omp_clauses_1): Handle GOVD_MAP_0LEN_ARRAY.
	If gimplify_omp_ctxp->target_firstprivatize_array_bases, use
	GOMP_MAP_FIRSTPRIVATE_POINTER map kind instead of
	GOMP_MAP_POINTER.
	(gimplify_adjust_omp_clauses): Add CODE argument.  Handle removal
	of GOMP_MAP_FIRSTPRIVATE_POINTER struct elements for struct not seen
	in target body.  Handle removal of struct mapping if struct is not
	seen in target body.  Remove GOMP_MAP_STRUCT map clause on
	OMP_TARGET_EXIT_DATA.  Adjust check for ORT_TARGET for the
	addition of ORT_COMBINED_TARGET.  Use GOMP_MAP_FIRSTPRIVATE_POINTER
	instead of GOMP_MAP_POINTER if ctx->target_firstprivatize_array_bases
	for VLAs.  Set OMP_CLAUSE_MAP_PRIVATE if both data sharing and map
	clause appear together.  Handle
	OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}.  Don't remove map
	clause if it has map-type-modifier always.  Handle
	OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN}
	clauses.
	(gimplify_oacc_cache, gimplify_omp_parallel, gimplify_omp_task):
	Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses
	callers.
	(gimplify_omp_for): Likewise.  Handle OMP_TASKLOOP.  Initialize
	loop_iter_var.  Use OMP_FOR_ORIG_DECLS.  Fix handling of lastprivate
	iterators in doacross loops.
	(gimplify_omp_workshare): Adjust gimplify_scan_omp_clauses and
	gimplify_adjust_omp_clauses callers.  Use ORT_COMBINED_TARGET
	for OMP_TARGET_COMBINED.  Adjust check for ORT_TARGET
	for the addition of ORT_COMBINED_TARGET.
	(gimplify_omp_target_update): Adjust gimplify_scan_omp_clauses and
	gimplify_adjust_omp_clauses callers.  Handle OMP_TARGET_ENTER_DATA
	and OMP_TARGET_EXIT_DATA.
	(gimplify_omp_ordered): New function.
	(gimplify_expr): Handle OMP_TASKLOOP, OMP_TARGET_ENTER_DATA and
	OMP_TARGET_EXIT_DATA.  Use gimplify_omp_ordered for OMP_ORDERED.
	Gimplify clauses on OMP_CRITICAL.
	* internal-fn.c (expand_GOMP_SIMD_ORDERED_START,
	expand_GOMP_SIMD_ORDERED_END): New functions.
	* internal-fn.def (GOMP_SIMD_ORDERED_START,
	GOMP_SIMD_ORDERED_END): New internal functions.
	* omp-builtins.def (BUILT_IN_GOMP_LOOP_DOACROSS_STATIC_START,
	BUILT_IN_GOMP_LOOP_DOACROSS_DYNAMIC_START,
	BUILT_IN_GOMP_LOOP_DOACROSS_GUIDED_START,
	BUILT_IN_GOMP_LOOP_DOACROSS_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_ULL_DOACROSS_STATIC_START,
	BUILT_IN_GOMP_LOOP_ULL_DOACROSS_DYNAMIC_START,
	BUILT_IN_GOMP_LOOP_ULL_DOACROSS_GUIDED_START,
	BUILT_IN_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START,
	BUILT_IN_GOMP_DOACROSS_POST, BUILT_IN_GOMP_DOACROSS_WAIT,
	BUILT_IN_GOMP_DOACROSS_ULL_POST, BUILT_IN_GOMP_DOACROSS_ULL_WAIT,
	BUILT_IN_GOMP_TARGET_ENTER_EXIT_DATA, BUILT_IN_GOMP_TASKLOOP,
	BUILT_IN_GOMP_TASKLOOP_ULL): New built-ins.
	(BUILT_IN_GOMP_TASK): Add INT argument to the end.
	(BUILT_IN_GOMP_TARGET): Rename from GOMP_target to GOMP_target_41,
	adjust type.
	(BUILT_IN_GOMP_TARGET_DATA): Rename from GOMP_target_data to
	GOMP_target_data_41, adjust type.
	(BUILT_IN_GOMP_TARGET_UPDATE): Rename from GOMP_target_update to
	GOMP_target_update_41, adjust type.
	* omp-low.c (struct omp_region): Adjust comments, add ord_stmt
	field.
	(struct omp_for_data): Add ordered and simd_schedule fields.
	(omp_member_access_dummy_var, unshare_and_remap_1,
	unshare_and_remap, is_taskloop_ctx): New functions.
	(is_taskreg_ctx): Use is_parallel_ctx and is_task_ctx.
	(extract_omp_for_data): Handle taskloops and doacross loops
	and simd schedule modifier.
	(omp_adjust_chunk_size): New function.
	(get_ws_args_for): Use it.
	(lookup_sfield): Change first argument to splay_tree_key,
	add overload with first argument tree.
	(maybe_lookup_field): Likewise.
	(use_pointer_for_field): Handle omp_member_access_dummy_var.
	(omp_copy_decl_2): If var is TREE_ADDRESSABLE listed in
	task_shared_vars, clear TREE_ADDRESSABLE on the copy.
	(build_outer_var_ref): Add LASTPRIVATE argument, handle
	taskloops and omp_member_access_dummy_var vars.
	(build_sender_ref): Change first argument to splay_tree_key,
	add overload with first argument tree.
	(install_var_field): For mask & 8 use &DECL_UID as key instead
	of the tree itself.
	(fixup_child_record_type): Const qualify *.omp_data_i.
	(scan_sharing_clauses): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE,
	C/C++ array reductions, OMP_CLAUSE_{IS,USE}_DEVICE_PTR clauses,
	OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,SIMDLEN,THREADS,SIMD} and
	OMP_CLAUSE_{NOGROUP,DEFAULTMAP} clauses, OMP_CLAUSE__LOOPTEMP_ clause
	on taskloop, GOMP_MAP_FIRSTPRIVATE_POINTER, OMP_CLAUSE_MAP_PRIVATE.
	(create_omp_child_function): Set TREE_READONLY on .omp_data_i.
	(find_combined_for): Allow searching for different GIMPLE_OMP_FOR
	kinds.
	(add_taskreg_looptemp_clauses): New function.
	(scan_omp_parallel): Use it.
	(scan_omp_task): Likewise.
	(finish_taskreg_scan): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE.
	For taskloop, move fields for the first two _LOOPTEMP_ clauses first.
	(check_omp_nesting_restrictions): Handle GF_OMP_TARGET_KIND_ENTER_DATA
	and GF_OMP_TARGET_KIND_EXIT_DATA.  Formatting fixes.  Allow the
	sandwiched taskloop constructs.  Type check
	OMP_CLAUSE_DEPEND_{KIND,SOURCE}.  Allow ordered simd inside of simd
	region.  Diagnose depend(source) or depend(sink:...) on
	target constructs or task/taskloop.
	(handle_simd_reference): Use get_name.
	(lower_rec_input_clauses): Likewise.  Ignore all
	OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE clauses on taskloop construct.
	Allow _LOOPTEMP_ clause on GOMP_TASK.  Unshare new_var
	before passing it to omp_clause_{default,copy}_ctor.  Handle
	OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL.  Set
	lastprivate_firstprivate flag for linear that needs copyin and
	copyout.  Use BUILT_IN_ALLOCA_WITH_ALIGN instead of BUILT_IN_ALLOCA.
	(lower_lastprivate_clauses): For OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE
	on taskloop lookup decl in outer context.  Pass true to
	build_outer_var_ref lastprivate argument.  Handle
	OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV lastprivate if the decl is global
	outside of outer taskloop for.
	(lower_reduction_clauses): Handle OMP_CLAUSE_REDUCTION with MEM_REF
	OMP_CLAUSE_DECL.
	(lower_send_clauses): Ignore first two _LOOPTEMP_ clauses in taskloop
	GOMP_TASK.  Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE.  Handle
	omp_member_access_dummy_var vars.  Handle OMP_CLAUSE_REDUCTION
	with MEM_REF OMP_CLAUSE_DECL.  Use new lookup_sfield overload.
	(lower_send_shared_vars): Ignore fields with NULL or FIELD_DECL
	abstract origin.  Handle omp_member_access_dummy_var vars.
	(expand_parallel_call): Use expand_omp_build_assign.
	(expand_task_call): Handle taskloop construct expansion.  Add
	REGION argument.  Use GOMP_TASK_* defines instead of hardcoded
	integers.  Add priority argument to GOMP_task* calls.  Or in
	GOMP_TASK_FLAG_PRIORITY into flags if priority is present for
	GOMP_task call.
	(expand_omp_build_assign): Add prototype.  Add AFTER
	argument, if true emit statements after *GSI_P and continue linking.
	(expand_omp_taskreg): Adjust expand_task_call caller.
	(expand_omp_for_init_counts): Rename zero_iter_bb argument to
	zero_iter1_bb and first_zero_iter to first_zero_iter1, add
	zero_iter2_bb and first_zero_iter2 arguments, handle computation
	of counts even for ordered loops.
	(expand_omp_for_init_vars): Handle GOMP_TASK inner_stmt.
	(expand_omp_ordered_source, expand_omp_ordered_sink,
	expand_omp_ordered_source_sink, expand_omp_for_ordered_loops): New
	functions.
	(expand_omp_for_generic): Use omp_adjust_chunk_size.  Handle linear
	clauses on worksharing loop.  Handle DOACROSS loop expansion.
	(expand_omp_for_static_nochunk): Handle linear clauses on
	worksharing loop.  Adjust expand_omp_for_init_counts
	callers.
	(expand_omp_for_static_chunk): Likewise.  Use omp_adjust_chunk_size.
	(expand_omp_simd): Handle addressable fd->loop.v.  Adjust
	expand_omp_for_init_counts callers.
	(expand_omp_taskloop_for_outer, expand_omp_taskloop_for_inner): New
	functions.
	(expand_omp_for): Call expand_omp_taskloop_for_* for taskloop.
	Handle doacross loops.
	(expand_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA and
	GF_OMP_TARGET_KIND_EXIT_DATA.  Pass flags and depend arguments to
	GOMP_target_{41,update_41,enter_exit_data} libcalls.
	(expand_omp): Don't expand ordered depend constructs here, record
	ord_stmt instead for later expand_omp_for_generic.
	(build_omp_regions_1): Handle GF_OMP_TARGET_KIND_ENTER_DATA and
	GF_OMP_TARGET_KIND_EXIT_DATA.  Treat GIMPLE_OMP_ORDERED with depend
	clause as stand-alone directive.
	(lower_omp_ordered_clauses): New function.
	(lower_omp_ordered): Handle OMP_CLAUSE_SIMD, for OMP_CLAUSE_DEPEND
	don't lower anything.
	(lower_omp_for_lastprivate): Use last _looptemp_ clause
	on taskloop for comparison.
	(lower_omp_for): Handle taskloop constructs.  Adjust OMP_CLAUSE_DECL
	and OMP_CLAUSE_LINEAR_STEP so that expand_omp_for_* can use it during
	expansion for linear adjustments.
	(create_task_copyfn): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE.
	(lower_depend_clauses): Assert not seeing sink/source depend kinds.
	Set TREE_ADDRESSABLE on array.  Change first argument from gimple *
	to tree * pointing to the stmt's clauses.
	(lower_omp_taskreg): Adjust lower_depend_clauses caller.
	(lower_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA
	and GF_OMP_TARGET_KIND_EXIT_DATA, depend clauses,
	GOMP_MAP_{RELEASE,ALWAYS_{TO,FROM,TOFROM},FIRSTPRIVATE_POINTER,STRUCT}
	map kinds, OMP_CLAUSE_{FIRSTPRIVATE,PRIVATE,{IS,USE}_DEVICE_PTR
	clauses.  Always use short kind and 8-bit align shift.
	(lower_omp_regimplify_p): Use IS_TYPE_OR_DECL_P macro.
	(struct lower_omp_regimplify_operands_data): New type.
	(lower_omp_regimplify_operands_p, lower_omp_regimplify_operands):
	New functions.
	(lower_omp_1): Use lower_omp_regimplify_operands instead of
	gimple_regimplify_operands.
	(make_gimple_omp_edges): Handle GF_OMP_TARGET_KIND_ENTER_DATA and
	GF_OMP_TARGET_KIND_EXIT_DATA.  Treat GIMPLE_OMP_ORDERED with depend
	clause as stand-alone directive.
	(simd_clone_clauses_extract): Honor OMP_CLAUSE_LINEAR_KIND.
	(simd_clone_mangle): Mangle the various linear kinds
	per the new ABI.
	(simd_clone_adjust_argument_types): Handle
	SIMD_CLONE_ARG_TYPE_LINEAR_*_CONSTANT_STEP.
	(simd_clone_init_simd_arrays): Don't do anything for uval.
	(simd_clone_adjust): Handle
	SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP like
	SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP.
	Handle SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP.
	* omp-low.h (omp_member_access_dummy_var): New prototype.
	* passes.def (pass_simduid_cleanup): Schedule another copy of the
	pass after all optimizations.
	* tree.c (omp_clause_code_name): Add entries for
	OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}
	and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}.
	(omp_clause_num_ops): Likewise.  Bump number of OMP_CLAUSE_REDUCTION
	arguments to 5 and for OMP_CLAUSE_ORDERED to 1.
	(walk_tree_1): Adjust for OMP_CLAUSE_ORDERED having 1 argument and
	OMP_CLAUSE_REDUCTION 5 arguments.  Handle
	OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}
	and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}
	clauses.
	* tree-core.h (enum omp_clause_linear_kind): New.
	(struct tree_omp_clause): Change type of map_kind
	from unsigned char to unsigned int.  Add subcode.if_modifier
	and subcode.linear_kind fields.
	(enum omp_clause_code): Add
	OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}
	and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}.
	(OMP_CLAUSE_REDUCTION): Document
	OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER.
	(enum omp_clause_depend_kind): Add OMP_CLAUSE_DEPEND_{SOURCE,SINK}.
	* tree.def (OMP_FOR): Add OMP_FOR_ORIG_DECLS operand.
	(OMP_CRITICAL): Move before OMP_SINGLE.  Add OMP_CRITICAL_CLAUSES
	operand.
	(OMP_ORDERED): Move before OMP_SINGLE.  Add OMP_ORDERED_CLAUSES
	operand.
	(OMP_TASKLOOP, OMP_TARGET_ENTER_DATA, OMP_TARGET_EXIT_DATA): New tree
	codes.
	* tree.h (OMP_BODY): Replace OMP_CRITICAL with OMP_TASKGROUP.
	(OMP_CLAUSE_SET_MAP_KIND): Cast to unsigned int rather than unsigned
	char.
	(OMP_CRITICAL_NAME): Adjust to be 3rd operand instead of 2nd.
	(OMP_CLAUSE_NUM_TASKS_EXPR): Formatting fix.
	(OMP_STANDALONE_CLAUSES): Adjust to cover OMP_TARGET_{ENTER,EXIT}_DATA.
	(OMP_CLAUSE_DEPEND_SINK_NEGATIVE, OMP_TARGET_COMBINED,
	OMP_CLAUSE_MAP_PRIVATE, OMP_FOR_ORIG_DECLS, OMP_CLAUSE_IF_MODIFIER,
	OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION, OMP_CRITICAL_CLAUSES,
	OMP_CLAUSE_PRIVATE_TASKLOOP_IV, OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV,
	OMP_CLAUSE_HINT_EXPR, OMP_CLAUSE_SCHEDULE_SIMD,
	OMP_CLAUSE_LINEAR_KIND, OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER,
	OMP_CLAUSE_SHARED_FIRSTPRIVATE, OMP_ORDERED_CLAUSES,
	OMP_TARGET_ENTER_DATA_CLAUSES, OMP_TARGET_EXIT_DATA_CLAUSES,
	OMP_CLAUSE_NUM_TASKS_EXPR, OMP_CLAUSE_GRAINSIZE_EXPR,
	OMP_CLAUSE_PRIORITY_EXPR, OMP_CLAUSE_ORDERED_EXPR): Define.
	* tree-inline.c (remap_gimple_stmt): Handle clauses on
	GIMPLE_OMP_ORDERED and GIMPLE_OMP_CRITICAL.  For
	IFN_GOMP_SIMD_ORDERED_{START,END} set has_simduid_loops.
	* tree-nested.c (convert_nonlocal_omp_clauses): Handle
	OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD}
	and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP}
	clauses.  Handle OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER.
	(convert_local_omp_clauses): Likewise.
	* tree-pretty-print.c (dump_omp_clause): Handle
	OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD}
	and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP}
	clauses.  Handle OMP_CLAUSE_IF_MODIFIER, OMP_CLAUSE_ORDERED_EXPR,
	OMP_CLAUSE_SCHEDULE_SIMD, OMP_CLAUSE_LINEAR_KIND,
	OMP_CLAUSE_DEPEND_{SOURCE,SINK}.  Use "delete" for
	GOMP_MAP_FORCE_DEALLOC.  Handle
	GOMP_MAP_{ALWAYS_{TO,FROM,TOFROM},RELEASE,FIRSTPRIVATE_POINTER,STRUCT}.
	(dump_generic_node): Handle OMP_TASKLOOP, OMP_TARGET_{ENTER,EXIT}_DATA
	and clauses on OMP_ORDERED and OMP_CRITICAL.
	* tree-vectorizer.c (adjust_simduid_builtins): Adjust comment.
	Remove IFN_GOMP_SIMD_ORDERED_{START,END}.
	(vectorize_loops): Adjust comments.
	(pass_simduid_cleanup::execute): Likewise.
	* tree-vect-stmts.c (vectorizable_simd_clone_call): Handle
	SIMD_CLONE_ARG_TYPE_LINEAR_{REF,VAL,UVAL}_CONSTANT_STEP.
	* wide-int.h (wi::gcd): New.
gcc/c-family/
2015-10-13  Jakub Jelinek  <jakub@redhat.com>
	    Aldy Hernandez  <aldyh@redhat.com>

	* c-common.c (enum c_builtin_type): Define DEF_FUNCTION_TYPE_9,
	DEF_FUNCTION_TYPE_10 and DEF_FUNCTION_TYPE_11.
	(c_define_builtins): Likewise.
	* c-common.h (enum c_omp_clause_split): Add
	C_OMP_CLAUSE_SPLIT_TASKLOOP.
	(c_finish_omp_critical, c_finish_omp_ordered): Add CLAUSES argument.
	(c_finish_omp_for): Add ORIG_DECLV argument.
	* c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP as
	201511 instead of 201307.
	* c-omp.c (c_finish_omp_critical): Add CLAUSES argument, set
	OMP_CRITICAL_CLAUSES to it.
	(c_finish_omp_ordered): Add CLAUSES argument, set
	OMP_ORDERED_CLAUSES to it.
	(c_finish_omp_for): Add ORIG_DECLV argument, set OMP_FOR_ORIG_DECLS
	to it if OMP_FOR.  Clear DECL_INITIAL on the IVs.
	(c_omp_split_clauses): Handle OpenMP 4.5 combined/composite
	constructs and new OpenMP 4.5 clauses.  Clear
	OMP_CLAUSE_SCHEDULE_SIMD if not combined with OMP_SIMD.  Add
	verification code.
	* c-pragma.c (omp_pragmas_simd): Add taskloop.
	* c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKLOOP.
	(enum pragma_omp_clause): Add
	PRAGMA_OMP_CLAUSE_{DEFAULTMAP,GRAINSIZE,HINT,{IS,USE}_DEVICE_PTR}
	and PRAGMA_OMP_CLAUSE_{LINK,NOGROUP,NUM_TASKS,PRIORITY,SIMD,THREADS}.
gcc/c/
2015-10-13  Jakub Jelinek  <jakub@redhat.com>
	    Aldy Hernandez  <aldyh@redhat.com>

	* c-parser.c (c_parser_pragma): Handle PRAGMA_OMP_ORDERED here.
	(c_parser_omp_clause_name): Handle OpenMP 4.5 clauses.
	(c_parser_omp_variable_list): Handle structure elements for
	map, to and from clauses.  Handle array sections in reduction
	clause.  Formatting fixes.
	(c_parser_omp_clause_if): Add IS_OMP argument, handle parsing of
	if clause modifiers.
	(c_parser_omp_clause_num_tasks, c_parser_omp_clause_grainsize,
	c_parser_omp_clause_priority, c_parser_omp_clause_hint,
	c_parser_omp_clause_defaultmap, c_parser_omp_clause_use_device_ptr,
	c_parser_omp_clause_is_device_ptr): New functions.
	(c_parser_omp_clause_ordered): Parse optional parameter.
	(c_parser_omp_clause_reduction): Handle array reductions.
	(c_parser_omp_clause_schedule): Parse optional simd modifier.
	(c_parser_omp_clause_nogroup, c_parser_omp_clause_orderedkind): New
	functions.
	(c_parser_omp_clause_linear): Parse linear clause modifiers.
	(c_parser_omp_clause_depend_sink): New function.
	(c_parser_omp_clause_depend): Parse source/sink depend kinds.
	(c_parser_omp_clause_map): Parse release/delete map kinds and
	optional always modifier.
	(c_parser_oacc_all_clauses): Adjust c_parser_omp_clause_if
	and c_finish_omp_clauses callers.
	(c_parser_omp_all_clauses): Likewise.  Parse OpenMP 4.5 clauses.
	Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive.
	(c_parser_oacc_cache): Adjust c_finish_omp_clauses caller.
	(OMP_CRITICAL_CLAUSE_MASK): Define.
	(c_parser_omp_critical): Parse critical clauses.
	(c_parser_omp_for_loop): Handle doacross loops, adjust
	c_finish_omp_for and c_finish_omp_clauses callers.
	(OMP_SIMD_CLAUSE_MASK): Add simdlen clause.
	(c_parser_omp_simd): Allow ordered clause if it has no parameter.
	(OMP_FOR_CLAUSE_MASK): Add linear clause.
	(c_parser_omp_for): Disallow ordered clause when combined with
	distribute.  Disallow linear clause when combined with distribute
	and not combined with simd.
	(OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define.
	(c_parser_omp_ordered): Add CONTEXT argument, remove LOC argument,
	parse clauses and if depend clause is found, don't parse a body.
	(c_parser_omp_parallel): Disallow copyin clause on target parallel.
	Allow target parallel without for after it.
	(OMP_TASK_CLAUSE_MASK): Add priority clause.
	(OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause.
	(c_parser_omp_target_data): Diagnose no map clauses or clauses with
	invalid kinds.
	(OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses.
	(OMP_TARGET_ENTER_DATA_CLAUSE_MASK,
	OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define.
	(c_parser_omp_target_enter_data, c_parser_omp_target_exit_data): New
	functions.
	(OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate,
	defaultmap and is_device_ptr clauses.
	(c_parser_omp_target): Parse target parallel and target simd.  Set
	OMP_TARGET_COMBINED on combined constructs.  Parse target enter data
	and target exit data.  Diagnose invalid map kinds.
	(OMP_DECLARE_TARGET_CLAUSE_MASK): Define.
	(c_parser_omp_declare_target): Parse OpenMP 4.5 forms of this
	construct.
	(c_parser_omp_declare_reduction): Use STRIP_NOPS when checking for
	&omp_priv.
	(OMP_TASKLOOP_CLAUSE_MASK): Define.
	(c_parser_omp_taskloop): New function.
	(c_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here,
	handle PRAGMA_OMP_TASKLOOP.
	(c_parser_cilk_for): Adjust c_finish_omp_clauses callers.
	* c-tree.h (c_finish_omp_clauses): Add two new arguments.
	* c-typeck.c (handle_omp_array_sections_1): Fix comment typo.
	Add IS_OMP argument, handle structure element bases, diagnose
	bitfields, pass IS_OMP recursively, diagnose known zero length
	array sections in depend clauses, handle array sections in reduction
	clause, diagnose negative length even for pointers.
	(handle_omp_array_sections): Add IS_OMP argument, use auto_vec for
	types, pass IS_OMP down to handle_omp_array_sections_1, handle
	array sections in reduction clause, set
	OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero
	length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP.
	(c_finish_omp_clauses): Add IS_OMP and DECLARE_SIMD arguments.
	Handle new OpenMP 4.5 clauses and new restrictions for the old ones.
gcc/cp/
2015-10-13  Jakub Jelinek  <jakub@redhat.com>
	    Aldy Hernandez  <aldyh@redhat.com>

	* class.c (finish_struct_1): Call finish_omp_declare_simd_methods.
	* cp-gimplify.c (cp_gimplify_expr): Handle OMP_TASKLOOP.
	(cp_genericize_r): Likewise.
	(cxx_omp_finish_clause): Don't diagnose references.
	(cxx_omp_disregard_value_expr): New function.
	* cp-objcp-common.h (LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR): Redefine.
	* cp-tree.h (OMP_FOR_GIMPLIFYING_P): Document for OMP_TASKLOOP.
	(DECL_OMP_PRIVATIZED_MEMBER): Define.
	(finish_omp_declare_simd_methods, push_omp_privatization_clauses,
	pop_omp_privatization_clauses, save_omp_privatization_clauses,
	restore_omp_privatization_clauses, omp_privatize_field,
	cxx_omp_disregard_value_expr): New prototypes.
	(finish_omp_clauses): Add two new arguments.
	(finish_omp_for): Add ORIG_DECLV argument.
	* parser.c (cp_parser_lambda_body): Call
	save_omp_privatization_clauses and restore_omp_privatization_clauses.
	(cp_parser_omp_clause_name): Handle OpenMP 4.5 clauses.
	(cp_parser_omp_var_list_no_open): Handle structure elements for
	map, to and from clauses.  Handle array sections in reduction
	clause.  Parse this keyword.  Formatting fixes.
	(cp_parser_omp_clause_if): Add IS_OMP argument, handle parsing of
	if clause modifiers.
	(cp_parser_omp_clause_num_tasks, cp_parser_omp_clause_grainsize,
	cp_parser_omp_clause_priority, cp_parser_omp_clause_hint,
	cp_parser_omp_clause_defaultmap): New functions.
	(cp_parser_omp_clause_ordered): Parse optional parameter.
	(cp_parser_omp_clause_reduction): Handle array reductions.
	(cp_parser_omp_clause_schedule): Parse optional simd modifier.
	(cp_parser_omp_clause_nogroup, cp_parser_omp_clause_orderedkind):
	New functions.
	(cp_parser_omp_clause_linear): Parse linear clause modifiers.
	(cp_parser_omp_clause_depend_sink): New function.
	(cp_parser_omp_clause_depend): Parse source/sink depend kinds.
	(cp_parser_omp_clause_map): Parse release/delete map kinds and
	optional always modifier.
	(cp_parser_oacc_all_clauses): Adjust cp_parser_omp_clause_if
	and finish_omp_clauses callers.
	(cp_parser_omp_all_clauses): Likewise.  Parse OpenMP 4.5 clauses.
	Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive.
	(OMP_CRITICAL_CLAUSE_MASK): Define.
	(cp_parser_omp_critical): Parse critical clauses.
	(cp_parser_omp_for_incr): Use cp_tree_equal if
	processing_template_decl.
	(cp_parser_omp_for_loop_init): Return tree instead of bool.  Handle
	non-static data member iterators.
	(cp_parser_omp_for_loop): Handle doacross loops, adjust
	finish_omp_for and finish_omp_clauses callers.
	(cp_omp_split_clauses): Adjust finish_omp_clauses caller.
	(OMP_SIMD_CLAUSE_MASK): Add simdlen clause.
	(cp_parser_omp_simd): Allow ordered clause if it has no parameter.
	(OMP_FOR_CLAUSE_MASK): Add linear clause.
	(cp_parser_omp_for): Disallow ordered clause when combined with
	distribute.  Disallow linear clause when combined with distribute
	and not combined with simd.
	(OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define.
	(cp_parser_omp_ordered): Add CONTEXT argument, return bool instead
	of tree, parse clauses and if depend clause is found, don't parse
	a body.
	(cp_parser_omp_parallel): Disallow copyin clause on target parallel.
	Allow target parallel without for after it.
	(OMP_TASK_CLAUSE_MASK): Add priority clause.
	(OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause.
	(cp_parser_omp_target_data): Diagnose no map clauses or clauses with
	invalid kinds.
	(OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses.
	(OMP_TARGET_ENTER_DATA_CLAUSE_MASK,
	OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define.
	(cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data): New
	functions.
	(OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate,
	defaultmap and is_device_ptr clauses.
	(cp_parser_omp_target): Parse target parallel and target simd.  Set
	OMP_TARGET_COMBINED on combined constructs.  Parse target enter data
	and target exit data.  Diagnose invalid map kinds.
	(cp_parser_oacc_cache): Adjust finish_omp_clauses caller.
	(OMP_DECLARE_TARGET_CLAUSE_MASK): Define.
	(cp_parser_omp_declare_target): Parse OpenMP 4.5 forms of this
	construct.
	(OMP_TASKLOOP_CLAUSE_MASK): Define.
	(cp_parser_omp_taskloop): New function.
	(cp_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here,
	handle PRAGMA_OMP_TASKLOOP.
	(cp_parser_pragma): Handle PRAGMA_OMP_ORDERED here directly,
	handle PRAGMA_OMP_TASKLOOP, call push_omp_privatization_clauses
	and pop_omp_privatization_clauses around parsing calls.
	(cp_parser_cilk_for): Adjust finish_omp_clauses caller.
	* pt.c (apply_late_template_attributes): Adjust tsubst_omp_clauses
	and finish_omp_clauses callers.
	(tsubst_omp_clause_decl): Return NULL if decl is NULL.
	For TREE_LIST, copy over OMP_CLAUSE_DEPEND_SINK_NEGATIVE bit.
	Use tsubst_expr instead of tsubst_copy, undo convert_from_reference
	effects.
	(tsubst_omp_clauses): Add ALLOW_FIELDS argument.  Handle new
	OpenMP 4.5 clauses.  Use tsubst_omp_clause_decl for more clauses.
	If ALLOW_FIELDS, handle non-static data members in the clauses.
	Clear OMP_CLAUSE_LINEAR_STEP if it has been cleared before.
	(omp_parallel_combined_clauses): New variable.
	(tsubst_omp_for_iterator): Add ORIG_DECLV argument, recur on
	OMP_FOR_ORIG_DECLS, handle non-static data member iterators.
	Improve handling of clauses on combined constructs.
	(tsubst_expr): Call push_omp_privatization_clauses and
	pop_omp_privatization_clauses around instantiation of certain
	OpenMP constructs, improve handling of clauses on combined
	constructs, handle OMP_TASKLOOP, adjust tsubst_omp_for_iterator,
	tsubst_omp_clauses and finish_omp_for callers, handle clauses on
	critical and ordered, handle OMP_TARGET_{ENTER,EXIT}_DATA.
	(instantiate_decl): Call save_omp_privatization_clauses and
	restore_omp_privatization_clauses around instantiation.
	(dependent_omp_for_p): Fix up comment typo.  Handle SCOPE_REF.
	* semantics.c (omp_private_member_map, omp_private_member_vec,
	omp_private_member_ignore_next): New variables.
	(finish_non_static_data_member): Return dummy decl for privatized
	non-static data members.
	(omp_clause_decl_field, omp_clause_printable_decl,
	omp_note_field_privatization, omp_privatize_field): New functions.
	(handle_omp_array_sections_1): Fix comment typo.
	Add IS_OMP argument, handle structure element bases, diagnose
	bitfields, pass IS_OMP recursively, diagnose known zero length
	array sections in depend clauses, handle array sections in reduction
	clause, diagnose negative length even for pointers.
	(handle_omp_array_sections): Add IS_OMP argument, use auto_vec for
	types, pass IS_OMP down to handle_omp_array_sections_1, handle
	array sections in reduction clause, set
	OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero
	length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP.
	(finish_omp_reduction_clause): Handle array sections and arrays.
	Use omp_clause_printable_decl.
	(finish_omp_declare_simd_methods, cp_finish_omp_clause_depend_sink):
	New functions.
	(finish_omp_clauses): Add ALLOW_FIELDS and DECLARE_SIMD arguments.
	Handle new OpenMP 4.5 clauses and new restrictions for the old
	ones, handle non-static data members, reject this keyword when not
	allowed.
	(push_omp_privatization_clauses, pop_omp_privatization_clauses,
	save_omp_privatization_clauses, restore_omp_privatization_clauses):
	New functions.
	(handle_omp_for_class_iterator): Handle OMP_TASKLOOP class iterators.
	Add collapse and ordered arguments.  Fix handling of lastprivate
	iterators in doacross loops.
	(finish_omp_for): Add ORIG_DECLV argument, handle doacross loops,
	adjust c_finish_omp_for, handle_omp_for_class_iterator and
	finish_omp_clauses callers.  Fill in OMP_CLAUSE_LINEAR_STEP on simd
	loops with non-static data member iterators.
gcc/fortran/
2015-10-13  Jakub Jelinek  <jakub@redhat.com>
	    Ilya Verbin  <ilya.verbin@intel.com>

	* f95-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
	DEF_FUNCTION_TYPE_11, DEF_FUNCTION_TYPE_VAR_1): Define.
	* trans-openmp.c (gfc_trans_omp_clauses): Set
	OMP_CLAUSE_IF_MODIFIER to ERROR_MARK, OMP_CLAUSE_ORDERED_EXPR
	to NULL.
	(gfc_trans_omp_critical): Adjust for addition of clauses.
	(gfc_trans_omp_ordered): Likewise.
	* types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR,
	BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR,
	BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR,
	BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR,
	BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR,
	BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR,
	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT,
	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG,
	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL,
	BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New.
	(BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR,
	BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR,
	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove.
gcc/lto/
2015-10-13  Jakub Jelinek  <jakub@redhat.com>

	* lto-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
	DEF_FUNCTION_TYPE_11): Define.
gcc/jit/
2015-10-13  Jakub Jelinek  <jakub@redhat.com>

	* jit-builtins.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
	DEF_FUNCTION_TYPE_11): Define.
	* jit-builtins.h (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
	DEF_FUNCTION_TYPE_11): Define.
gcc/ada/
2015-10-13  Jakub Jelinek  <jakub@redhat.com>

	* gcc-interface/utils.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
	DEF_FUNCTION_TYPE_11): Define.
gcc/testsuite/
2015-10-13  Jakub Jelinek  <jakub@redhat.com>
	    Aldy Hernandez  <aldyh@redhat.com>

	* c-c++-common/gomp/cancel-1.c (f2): Add map clause to target data.
	* c-c++-common/gomp/clauses-1.c: New test.
	* c-c++-common/gomp/clauses-2.c: New test.
	* c-c++-common/gomp/clauses-3.c: New test.
	* c-c++-common/gomp/clauses-4.c: New test.
	* c-c++-common/gomp/declare-target-1.c: New test.
	* c-c++-common/gomp/declare-target-2.c: New test.
	* c-c++-common/gomp/depend-3.c: New test.
	* c-c++-common/gomp/depend-4.c: New test.
	* c-c++-common/gomp/doacross-1.c: New test.
	* c-c++-common/gomp/if-1.c: New test.
	* c-c++-common/gomp/if-2.c: New test.
	* c-c++-common/gomp/linear-1.c: New test.
	* c-c++-common/gomp/map-2.c: New test.
	* c-c++-common/gomp/map-3.c: New test.
	* c-c++-common/gomp/nesting-1.c (f_omp_parallel,
	f_omp_target_data): Add map clause to target data.
	* c-c++-common/gomp/nesting-warn-1.c (f_omp_target): Likewise.
	* c-c++-common/gomp/ordered-1.c: New test.
	* c-c++-common/gomp/ordered-2.c: New test.
	* c-c++-common/gomp/ordered-3.c: New test.
	* c-c++-common/gomp/pr61486-1.c (foo): Remove linear clause
	on non-iterator.
	* c-c++-common/gomp/pr61486-2.c (test, test2): Remove ordered
	clause and ordered construct where no longer allowed.
	* c-c++-common/gomp/priority-1.c: New test.
	* c-c++-common/gomp/reduction-1.c: New test.
	* c-c++-common/gomp/schedule-simd-1.c: New test.
	* c-c++-common/gomp/sink-1.c: New test.
	* c-c++-common/gomp/sink-2.c: New test.
	* c-c++-common/gomp/sink-3.c: New test.
	* c-c++-common/gomp/sink-4.c: New test.
	* c-c++-common/gomp/udr-1.c: New test.
	* c-c++-common/taskloop-1.c: New test.
	* c-c++-common/cpp/openmp-define-3.c: Adjust for the new
	value of _OPENMP macro.
	* c-c++-common/cilk-plus/PS/body.c (foo): Adjust expected diagnostics.
	* c-c++-common/goacc-gomp/nesting-fail-1.c (f_acc_parallel,
	f_acc_kernels, f_acc_data, f_acc_loop): Add map clause to target data.
	* gcc.dg/gomp/clause-1.c:
	* gcc.dg/gomp/reduction-1.c: New test.
	* gcc.dg/gomp/sink-fold-1.c: New test.
	* gcc.dg/gomp/sink-fold-2.c: New test.
	* gcc.dg/gomp/sink-fold-3.c: New test.
	* gcc.dg/vect/vect-simd-clone-15.c: New test.
	* g++.dg/gomp/clause-1.C (T::test): Remove dg-error on privatization
	of non-static data members.
	* g++.dg/gomp/clause-3.C (foo): Remove one dg-error directive.
	Add some linear clause tests.
	* g++.dg/gomp/declare-simd-3.C: New test.
	* g++.dg/gomp/linear-1.C: New test.
	* g++.dg/gomp/member-1.C: New test.
	* g++.dg/gomp/member-2.C: New test.
	* g++.dg/gomp/pr66571-2.C: New test.
	* g++.dg/gomp/pr67504.C (foo): Add test for ordered clause with
	dependent argument.
	* g++.dg/gomp/pr67522.C (foo): Add test for invalid array section
	in reduction clause.
	* g++.dg/gomp/reference-1.C: New test.
	* g++.dg/gomp/sink-1.C: New test.
	* g++.dg/gomp/sink-2.C: New test.
	* g++.dg/gomp/sink-3.C: New test.
	* g++.dg/gomp/task-1.C: Remove both dg-error directives.
	* g++.dg/gomp/this-1.C: New test.
	* g++.dg/gomp/this-2.C: New test.
	* g++.dg/vect/simd-clone-2.cc: New test.
	* g++.dg/vect/simd-clone-2.h: New test.
	* g++.dg/vect/simd-clone-3.cc: New test.
	* g++.dg/vect/simd-clone-4.cc: New test.
	* g++.dg/vect/simd-clone-4.h: New test.
	* g++.dg/vect/simd-clone-5.cc: New test.
include/
2015-10-13  Jakub Jelinek  <jakub@redhat.com>
	    Ilya Verbin  <ilya.verbin@intel.com>

	* gomp-constants.h (GOMP_MAP_FLAG_ALWAYS): Define.
	(enum gomp_map_kind): Add GOMP_MAP_FIRSTPRIVATE,
	GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_USE_DEVICE_PTR,
	GOMP_MAP_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_ALWAYS_TO,
	GOMP_MAP_ALWAYS_FROM, GOMP_MAP_ALWAYS_TOFROM, GOMP_MAP_STRUCT,
	GOMP_MAP_DELETE_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_DELETE,
	GOMP_MAP_RELEASE, GOMP_MAP_FIRSTPRIVATE_POINTER.
	(GOMP_MAP_ALWAYS_TO_P, GOMP_MAP_ALWAYS_FROM_P): Define.
	(GOMP_TASK_FLAG_UNTIED, GOMP_TASK_FLAG_FINAL, GOMP_TASK_FLAG_MERGEABLE,
	GOMP_TASK_FLAG_DEPEND, GOMP_TASK_FLAG_PRIORITY, GOMP_TASK_FLAG_UP,
	GOMP_TASK_FLAG_GRAINSIZE, GOMP_TASK_FLAG_IF, GOMP_TASK_FLAG_NOGROUP,
	GOMP_TARGET_FLAG_NOWAIT, GOMP_TARGET_FLAG_EXIT_DATA,
	GOMP_TARGET_FLAG_UPDATE): Define.
libgomp/
2015-10-13  Jakub Jelinek  <jakub@redhat.com>
	    Aldy Hernandez  <aldyh@redhat.com>
	    Ilya Verbin  <ilya.verbin@intel.com>

	* config/linux/affinity.c (omp_get_place_num_procs,
	omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions.
	* config/linux/doacross.h: New file.
	* config/posix/affinity.c (omp_get_place_num_procs,
	omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions.
	* config/posix/doacross.h: New file.
	* env.c: Include gomp-constants.h.
	(struct gomp_task_icv): Rename run_sched_modifier to
	run_sched_chunk_size.
	(gomp_max_task_priority_var): New variable.
	(parse_schedule): Rename run_sched_modifier to run_sched_chunk_size.
	(handle_omp_display_env): Change _OPENMP value from 201307 to
	201511.  Print OMP_MAX_TASK_PRIORITY.
	(initialize_env): Parse OMP_MAX_TASK_PRIORITY.
	(omp_set_schedule, omp_get_schedule): Rename modifier argument to
	chunk_size and run_sched_modifier to run_sched_chunk_size.
	(omp_get_max_task_priority, omp_get_initial_device,
	omp_get_num_places, omp_get_place_num, omp_get_partition_num_places,
	omp_get_partition_place_nums): New functions.
	* fortran.c (omp_set_schedule_, omp_set_schedule_8_,
	omp_get_schedule_, omp_get_schedule_8_): Rename modifier argument
	to chunk_size.
	(omp_get_num_places_, omp_get_place_num_procs_,
	omp_get_place_num_procs_8_, omp_get_place_proc_ids_,
	omp_get_place_proc_ids_8_, omp_get_place_num_,
	omp_get_partition_num_places_, omp_get_partition_place_nums_,
	omp_get_partition_place_nums_8_, omp_get_initial_device_,
	omp_get_max_task_priority_): New functions.
	* libgomp_g.h (GOMP_loop_doacross_static_start,
	GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start,
	GOMP_loop_doacross_runtime_start, GOMP_loop_ull_doacross_static_start,
	GOMP_loop_ull_doacross_dynamic_start,
	GOMP_loop_ull_doacross_guided_start,
	GOMP_loop_ull_doacross_runtime_start, GOMP_doacross_post,
	GOMP_doacross_wait, GOMP_doacross_ull_post, GOMP_doacross_wait,
	GOMP_taskloop, GOMP_taskloop_ull, GOMP_target_41,
	GOMP_target_data_41, GOMP_target_update_41,
	GOMP_target_enter_exit_data): New prototypes.
	(GOMP_task): Add prototype argument.
	* libgomp.h (_LIBGOMP_CHECKING_): Define to 0 if not yet defined.
	(struct gomp_doacross_work_share): New type.
	(struct gomp_work_share): Add doacross field.
	(struct gomp_task_icv): Rename run_sched_modifier to
	run_sched_chunk_size.
	(enum gomp_task_kind): Rename GOMP_TASK_IFFALSE to
	GOMP_TASK_UNDEFERRED.  Add comments.
	(struct gomp_task_depend_entry): Add comments.
	(struct gomp_task): Likewise.
	(struct gomp_taskgroup): Likewise.
	(struct gomp_target_task): New type.
	(struct gomp_team): Add comment.
	(gomp_get_place_proc_ids_8, gomp_doacross_init,
	gomp_doacross_ull_init, gomp_task_maybe_wait_for_dependencies,
	gomp_create_target_task, gomp_target_task_fn): New prototypes.
	(struct target_var_desc): New type.
	(struct target_mem_desc): Adjust comment.  Use struct
	target_var_desc instead of splay_tree_key for list.
	(REFCOUNT_INFINITY): Define.
	(struct splay_tree_key_s): Remove copy_from field.
	(struct gomp_device_descr): Add dev2dev_func field.
	(enum gomp_map_vars_kind): New enum.
	(gomp_map_vars): Add one argument.
	* libgomp.map (OMP_4.5): Export omp_get_max_task_priority,
	omp_get_max_task_priority_, omp_get_num_places, omp_get_num_places_,
	omp_get_place_num_procs, omp_get_place_num_procs_,
	omp_get_place_num_procs_8_, omp_get_place_proc_ids,
	omp_get_place_proc_ids_, omp_get_place_proc_ids_8_, omp_get_place_num,
	omp_get_place_num_, omp_get_partition_num_places,
	omp_get_partition_num_places_, omp_get_partition_place_nums,
	omp_get_partition_place_nums_, omp_get_partition_place_nums_8_,
	omp_get_initial_device, omp_get_initial_device_, omp_target_alloc,
	omp_target_free, omp_target_is_present, omp_target_memcpy,
	omp_target_memcpy_rect, omp_target_associate_ptr and
	omp_target_disassociate_ptr.
	(GOMP_4.0.2): Renamed to ...
	(GOMP_4.5): ... this.  Export GOMP_target_41, GOMP_target_data_41,
	GOMP_target_update_41, GOMP_target_enter_exit_data, GOMP_taskloop,
	GOMP_taskloop_ull, GOMP_loop_doacross_dynamic_start,
	GOMP_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start,
	GOMP_loop_doacross_static_start, GOMP_doacross_post,
	GOMP_doacross_wait, GOMP_loop_ull_doacross_dynamic_start,
	GOMP_loop_ull_doacross_guided_start,
	GOMP_loop_ull_doacross_runtime_start,
	GOMP_loop_ull_doacross_static_start, GOMP_doacross_ull_post and
	GOMP_doacross_ull_wait.
	* libgomp.texi: Document omp_get_max_task_priority.
	Rename modifier argument to chunk_size for omp_set_schedule and
	omp_get_schedule.  Document OMP_MAX_TASK_PRIORITY env var.
	* loop.c (GOMP_loop_runtime_start): Adjust for run_sched_modifier
	to run_sched_chunk_size renaming.
	(GOMP_loop_ordered_runtime_start): Likewise.
	(gomp_loop_doacross_static_start, gomp_loop_doacross_dynamic_start,
	gomp_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start,
	GOMP_parallel_loop_runtime_start): New functions.
	(GOMP_parallel_loop_runtime): Adjust for run_sched_modifier
	to run_sched_chunk_size renaming.
	(GOMP_loop_doacross_static_start, GOMP_loop_doacross_dynamic_start,
	GOMP_loop_doacross_guided_start): New functions or aliases.
	* loop_ull.c (GOMP_loop_ull_runtime_start): Adjust for
	run_sched_modifier to run_sched_chunk_size renaming.
	(GOMP_loop_ull_ordered_runtime_start): Likewise.
	(gomp_loop_ull_doacross_static_start,
	gomp_loop_ull_doacross_dynamic_start,
	gomp_loop_ull_doacross_guided_start,
	GOMP_loop_ull_doacross_runtime_start): New functions.
	(GOMP_loop_ull_doacross_static_start,
	GOMP_loop_ull_doacross_dynamic_start,
	GOMP_loop_ull_doacross_guided_start): New functions or aliases.
	* oacc-mem.c (acc_map_data, present_create_copy,
	gomp_acc_insert_pointer): Pass GOMP_MAP_VARS_OPENACC instead of false
	to gomp_map_vars.
	(gomp_acc_remove_pointer): Use copy_from from target_var_desc.
	* oacc-parallel.c (GOACC_data_start): Pass GOMP_MAP_VARS_OPENACC
	instead of false to gomp_map_vars.
	(GOACC_parallel_keyed): Likewise.  Use copy_from from target_var_desc.
	* omp.h.in (omp_lock_hint_t): New type.
	(omp_init_lock_with_hint, omp_init_nest_lock_with_hint,
	omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids,
	omp_get_place_num, omp_get_partition_num_places,
	omp_get_partition_place_nums, omp_get_initial_device,
	omp_get_max_task_priority, omp_target_alloc, omp_target_free,
	omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect,
	omp_target_associate_ptr, omp_target_disassociate_ptr): New
	prototypes.
	* omp_lib.f90.in (omp_lock_hint_kind): New parameter.
	(omp_lock_hint_none, omp_lock_hint_uncontended,
	omp_lock_hint_contended, omp_lock_hint_nonspeculative,
	omp_lock_hint_speculative): New parameters.
	(omp_init_lock_with_hint, omp_init_nest_lock_with_hint,
	omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids,
	omp_get_place_num, omp_get_partition_num_places,
	omp_get_partition_place_nums, omp_get_initial_device,
	omp_get_max_task_priority): New interfaces.
	(omp_set_schedule, omp_get_schedule): Rename modifier argument
	to chunk_size.
	* omp_lib.h.in (omp_lock_hint_kind): New parameter.
	(omp_lock_hint_none, omp_lock_hint_uncontended,
	omp_lock_hint_contended, omp_lock_hint_nonspeculative,
	omp_lock_hint_speculative): New parameters.
	(omp_init_lock_with_hint, omp_init_nest_lock_with_hint,
	omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids,
	omp_get_place_num, omp_get_partition_num_places,
	omp_get_partition_place_nums, omp_get_initial_device,
	omp_get_max_task_priority): New functions and subroutines.
	* ordered.c: Include stdarg.h and string.h.
	(MAX_COLLAPSED_BITS): Define.
	(gomp_doacross_init, GOMP_doacross_post, GOMP_doacross_wait,
	gomp_doacross_ull_init, GOMP_doacross_ull_post,
	GOMP_doacross_ull_wait): New functions.
	* target.c: Include errno.h.
	(resolve_device): If device is not initialized, call
	gomp_init_device on it.
	(gomp_map_lookup): New function.
	(gomp_map_vars_existing): Add tgt_var argument, fill it in.
	Don't bump refcount if REFCOUNT_INFINITY.  Handle
	GOMP_MAP_ALWAYS_TO_P.
	(get_kind): Rename is_openacc argument to short_mapkind.
	(gomp_map_pointer): Use gomp_map_lookup.
	(gomp_map_fields_existing): New function.
	(gomp_map_vars): Rename is_openacc argument to short_mapkind
	and is_target to pragma_kind.  Handle GOMP_MAP_VARS_ENTER_DATA,
	handle GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_STRUCT,
	GOMP_MAP_USE_DEVICE_PTR, GOMP_MAP_ZERO_LEN_ARRAY_SECTION.
	Adjust for tgt->list changed type and copy_from living in there.
	(gomp_copy_from_async): Adjust for tgt->list changed type and
	copy_from living in there.
	(gomp_unmap_vars): Likewise.
	(gomp_update): Likewise.  Rename is_openacc argument to
	short_mapkind.  Don't fail if object is not mapped.
	(gomp_load_image_to_device): Initialize refcount to
	REFCOUNT_INFINITY.
	(gomp_target_fallback): New function.
	(gomp_get_target_fn_addr): Likewise.
	(GOMP_target): Adjust gomp_map_vars caller, use
	gomp_get_target_fn_addr and gomp_target_fallback.
	(GOMP_target_41): New function.
	(gomp_target_data_fallback): New function.
	(GOMP_target_data): Use it, adjust gomp_map_vars caller.
	(GOMP_target_data_41): New function.
	(GOMP_target_update): Adjust gomp_update caller.
	(GOMP_target_update_41): New function.
	(gomp_exit_data, GOMP_target_enter_exit_data,
	gomp_target_task_fn, omp_target_alloc, omp_target_free,
	omp_target_is_present, omp_target_memcpy,
	omp_target_memcpy_rect_worker, omp_target_memcpy_rect,
	omp_target_associate_ptr, omp_target_disassociate_ptr,
	gomp_load_plugin_for_device): New functions.
	* task.c: Include gomp-constants.h.  Include taskloop.c
	twice to get GOMP_taskloop and GOMP_taskloop_ull definitions.
	(gomp_task_handle_depend): New function.
	(GOMP_task): Use it.  Add priority argument.  Use
	gomp-constant.h constants instead of hardcoded numbers.
	Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED.
	(gomp_create_target_task): New function.
	(verify_children_queue, verify_taskgroup_queue,
	verify_task_queue): New functions.
	(gomp_task_run_pre): Call verify_*_queue functions.
	If an upcoming tied task is about to leave the sibling or
	taskgroup queues in an invalid state, adjust appropriately.
	Remove taskgroup argument.  Add comments.
	(gomp_task_run_post_handle_dependers): Add comments.
	(gomp_task_run_post_remove_parent): Likewise.
	(gomp_barrier_handle_tasks): Adjust gomp_task_run_pre caller.
	(GOMP_taskwait): Likewise.  Add comments.
	(gomp_task_maybe_wait_for_dependencies): Fix scheduling
	problem such that the first non parent_depends_on task does not
	end up at the end of the children queue.
	(GOMP_taskgroup_start): Rename GOMP_TASK_IFFALSE to
	GOMP_TASK_UNDEFERRED.
	(GOMP_taskgroup_end): Adjust gomp_task_run_pre caller.
	* taskloop.c: New file.
	* testsuite/lib/libgomp.exp
	(check_effective_target_offload_device_nonshared_as): New proc.
	* testsuite/libgomp.c/affinity-2.c: New test.
	* testsuite/libgomp.c/doacross-1.c: New test.
	* testsuite/libgomp.c/doacross-2.c: New test.
	* testsuite/libgomp.c/examples-4/declare_target-1.c (fib_wrapper):
	Add map clause to target.
	* testsuite/libgomp.c/examples-4/declare_target-4.c (accum): Likewise.
	* testsuite/libgomp.c/examples-4/declare_target-5.c (accum): Likewise.
	* testsuite/libgomp.c/examples-4/device-1.c (main): Likewise.
	* testsuite/libgomp.c/examples-4/device-3.c (main): Likewise.
	* testsuite/libgomp.c/examples-4/target_data-3.c (gramSchmidt):
	Likewise.
	* testsuite/libgomp.c/examples-4/teams-2.c (dotprod): Likewise.
	* testsuite/libgomp.c/examples-4/teams-3.c (dotprod): Likewise.
	* testsuite/libgomp.c/examples-4/teams-4.c (dotprod): Likewise.
	* testsuite/libgomp.c/for-2.h (OMPTGT, OMPTO, OMPFROM): Define if
	not defined.  Use those where needed.
	* testsuite/libgomp.c/for-4.c: New test.
	* testsuite/libgomp.c/for-5.c: New test.
	* testsuite/libgomp.c/for-6.c: New test.
	* testsuite/libgomp.c/linear-1.c: New test.
	* testsuite/libgomp.c/ordered-4.c: New test.
	* testsuite/libgomp.c/pr66199-2.c (f2): Adjust for linear clause
	only allowed on the loop iterator.
	* testsuite/libgomp.c/pr66199-3.c: New test.
	* testsuite/libgomp.c/pr66199-4.c: New test.
	* testsuite/libgomp.c/reduction-7.c: New test.
	* testsuite/libgomp.c/reduction-8.c: New test.
	* testsuite/libgomp.c/reduction-9.c: New test.
	* testsuite/libgomp.c/reduction-10.c: New test.
	* testsuite/libgomp.c/target-1.c (fn2, fn3, fn4): Add
	map(tofrom:s).
	* testsuite/libgomp.c/target-2.c (fn2, fn3, fn4): Likewise.
	* testsuite/libgomp.c/target-7.c (foo): Add map(h) where needed.
	* testsuite/libgomp.c/target-11.c: New test.
	* testsuite/libgomp.c/target-12.c: New test.
	* testsuite/libgomp.c/target-13.c: New test.
	* testsuite/libgomp.c/target-14.c: New test.
	* testsuite/libgomp.c/target-15.c: New test.
	* testsuite/libgomp.c/target-16.c: New test.
	* testsuite/libgomp.c/target-17.c: New test.
	* testsuite/libgomp.c/target-18.c: New test.
	* testsuite/libgomp.c/target-19.c: New test.
	* testsuite/libgomp.c/target-20.c: New test.
	* testsuite/libgomp.c/target-21.c: New test.
	* testsuite/libgomp.c/target-22.c: New test.
	* testsuite/libgomp.c/target-23.c: New test.
	* testsuite/libgomp.c/target-24.c: New test.
	* testsuite/libgomp.c/target-25.c: New test.
	* testsuite/libgomp.c/target-26.c: New test.
	* testsuite/libgomp.c/target-27.c: New test.
	* testsuite/libgomp.c/taskloop-1.c: New test.
	* testsuite/libgomp.c/taskloop-2.c: New test.
	* testsuite/libgomp.c/taskloop-3.c: New test.
	* testsuite/libgomp.c/taskloop-4.c: New test.
	* testsuite/libgomp.c++/ctor-13.C: New test.
	* testsuite/libgomp.c++/doacross-1.C: New test.
	* testsuite/libgomp.c++/examples-4/declare_target-2.C:
	Replace offload_device with offload_device_nonshared_as.
	* testsuite/libgomp.c++/for-12.C: New test.
	* testsuite/libgomp.c++/for-13.C: New test.
	* testsuite/libgomp.c++/for-14.C: New test.
	* testsuite/libgomp.c++/linear-1.C: New test.
	* testsuite/libgomp.c++/member-1.C: New test.
	* testsuite/libgomp.c++/member-2.C: New test.
	* testsuite/libgomp.c++/member-3.C: New test.
	* testsuite/libgomp.c++/member-4.C: New test.
	* testsuite/libgomp.c++/member-5.C: New test.
	* testsuite/libgomp.c++/ordered-1.C: New test.
	* testsuite/libgomp.c++/reduction-5.C: New test.
	* testsuite/libgomp.c++/reduction-6.C: New test.
	* testsuite/libgomp.c++/reduction-7.C: New test.
	* testsuite/libgomp.c++/reduction-8.C: New test.
	* testsuite/libgomp.c++/reduction-9.C: New test.
	* testsuite/libgomp.c++/reduction-10.C: New test.
	* testsuite/libgomp.c++/reference-1.C: New test.
	* testsuite/libgomp.c++/simd14.C: New test.
	* testsuite/libgomp.c++/target-2.C (fn2): Add map(tofrom: s) clause.
	* testsuite/libgomp.c++/target-5.C: New test.
	* testsuite/libgomp.c++/target-6.C: New test.
	* testsuite/libgomp.c++/target-7.C: New test.
	* testsuite/libgomp.c++/target-8.C: New test.
	* testsuite/libgomp.c++/target-9.C: New test.
	* testsuite/libgomp.c++/target-10.C: New test.
	* testsuite/libgomp.c++/target-11.C: New test.
	* testsuite/libgomp.c++/target-12.C: New test.
	* testsuite/libgomp.c++/taskloop-1.C: New test.
	* testsuite/libgomp.c++/taskloop-2.C: New test.
	* testsuite/libgomp.c++/taskloop-3.C: New test.
	* testsuite/libgomp.c++/taskloop-4.C: New test.
	* testsuite/libgomp.c++/taskloop-5.C: New test.
	* testsuite/libgomp.c++/taskloop-6.C: New test.
	* testsuite/libgomp.c++/taskloop-7.C: New test.
	* testsuite/libgomp.c++/taskloop-8.C: New test.
	* testsuite/libgomp.c++/taskloop-9.C: New test.
	* testsuite/libgomp.fortran/affinity1.f90: New test.
	* testsuite/libgomp.fortran/affinity2.f90: New test.
liboffloadmic/
2015-10-13  Ilya Verbin  <ilya.verbin@intel.com>

	* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_dev2dev): New
	function.
	* plugin/offload_target_main.cpp (__offload_target_tgt2tgt): New
	static function, register it in liboffloadmic.

From-SVN: r228777
2015-10-13 21:06:23 +02:00
Jason Merrill 8237beb118 re PR c++/67810 (Non-expression recognized as fold expression)
PR c++/67810
	* parser.c (cp_parser_fold_expr_p): Remove.
	(is_binary_op): New.
	(cp_parser_fold_expression): Take LHS as parameter.
	(cp_parser_primary_expression): Call it after parsing an expression.
	(cp_parser_binary_expression, cp_parser_assignment_operator_opt)
	(cp_parser_expression): Ignore an operator followed by '...'.
	(is_binary_op): New.
	* pt.c (tsubst_unary_left_fold, tsubst_binary_left_fold)
	(tsubst_unary_right_fold, tsubst_binary_right_fold): Handle errors.

From-SVN: r228556
2015-10-06 21:46:54 -04:00
Paolo Carlini fcbc0f7cf7 re PR c++/53856 (Default argument allowed on member defined outside of class template)
/cp
2015-10-05  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/53856
	* pt.c (check_default_tmpl_args): Per [temp.param]/9, do not
	reject default template arguments in out of class definitions
	of members of non-template classes.

/testsuite
2015-10-05  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/53856
	* g++.dg/template/defarg19.C: New.
	* g++.dg/template/defarg20.C: Likewise.

From-SVN: r228501
2015-10-05 21:43:26 +00:00
Nathan Sidwell 6b333269be c.opt (Wmultiple-inheritance, [...]): New C++ warnings.
c-family/
	* c.opt (Wmultiple-inheritance, Wvirtual-inheritance, Wtemplates,
	Wnamespaces): New C++ warnings.

	cp/
	* decl.c (xref_basetypes): Check virtual and/or multiple
	inheritance warning.
	* parser.c (cp_parser_namespace_definition): Check namespaces
	warning.
	* pt.c (push_template_decl_real): Check templates warning.

	* doc/invoke.texi  (-Wmultiple-inheritance, -Wvirtual-inheritance,
	-Wtemplates, -Wnamespaces): Document.

	testsuite/
	* g++.dg/diagostic/disable.C: New.

From-SVN: r228019
2015-09-22 15:34:49 +00:00
Andrew Sutton 378b307d0d Implement N4295 fold-expressions.
* cp-tree.def: Add UNARY_LEFT_FOLD_EXPR, UNARY_RIGHT_FOLD_EXPR,
	BINARY_LEFT_FOLD_EXPR, BINARY_RIGHT_FOLD_EXPR.
	* cp-objcp-common.c (cp_common_init_ts): Handle them.
	* cp-tree.h (FOLD_EXPR_CHECK, BINARY_FOLD_EXPR_CHECK, FOLD_EXPR_P)
	(FOLD_EXPR_MODIFY_P, FOLD_EXPR_OP, FOLD_EXPR_PACK, FOLD_EXPR_INIT): New.
	* parser.c (cp_parser_skip_to_closing_parenthesis): Split out...
	(cp_parser_skip_to_closing_parenthesis_1): This function.  Change
	or_comma parameter to or_ttype.
	(cp_parser_fold_operator, cp_parser_fold_expr_p)
	(cp_parser_fold_expression): New.
	(cp_parser_primary_expression): Use them.
	* pt.c (expand_empty_fold, fold_expression, tsubst_fold_expr_pack)
	(tsubst_fold_expr_init, expand_left_fold, tsubst_unary_left_fold)
	(tsubst_binary_left_fold, expand_right_fold)
	(tsubst_unary_right_fold, tsubst_binary_right_fold): New.
	(tsubst_copy): Use them.
	(type_dependent_expression_p): Handle fold-expressions.
	* semantics.c (finish_unary_fold_expr)
	(finish_left_unary_fold_expr, finish_right_unary_fold_expr)
	(finish_binary_fold_expr): New.

Co-Authored-By: Jason Merrill <jason@redhat.com>

From-SVN: r227883
2015-09-17 14:26:06 -04:00
Jason Merrill 979734578a re PR c++/67041 ([C++14] Variable template initialized by call to lambda does not compile)
PR c++/67041
	* pt.c (tsubst_copy_and_build): Handle variables like functions.

From-SVN: r227553
2015-09-08 15:33:47 -04:00
Paolo Carlini 761f8e2f8a re PR c++/67369 (ICE (in tsubst_decl, at cp/pt.c:11302) with -std=c++14)
/cp
2015-09-08  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/67369
	* pt.c (tsubst_copy, [case FUNCTION_DECL]): Do not call tsubst
	if the first argument isn't a template.

/testsuite
2015-09-08  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/67369
	* g++.dg/cpp1y/lambda-generic-ice4.C: New.

From-SVN: r227530
2015-09-08 15:02:01 +00:00
Martin Sebor 1807ffc1a5 re PR c/66516 (missing diagnostic on taking the address of a builtin function)
gcc/ChangeLog
2015-09-03  Martin Sebor  <msebor@redhat.com>

	PR c/66516
	* doc/extend.texi (Other Builtins): Document when the address
	of a built-in function can be taken.

gcc/c-family/ChangeLog
2015-09-03  Martin Sebor  <msebor@redhat.com>

	PR c/66516
	* c-common.h (c_decl_implicit, reject_gcc_builtin): Declare new
	functions.
	* c-common.c (reject_gcc_builtin): Define.

gcc/c/ChangeLog
2015-09-03  Martin Sebor  <msebor@redhat.com>

	PR c/66516
	* c/c-typeck.c (convert_arguments, parser_build_unary_op)
	(build_conditional_expr, c_cast_expr, convert_for_assignment)
	(build_binary_op, _objc_common_truthvalue_conversion): Call
	reject_gcc_builtin.
	(c_decl_implicit): Define.

gcc/cp/ChangeLog
2015-09-03  Martin Sebor  <msebor@redhat.com>

	PR c/66516
	* cp/cp-tree.h (mark_rvalue_use, decay_conversion): Add new
	argument(s).
	* cp/expr.c (mark_rvalue_use): Use new argument.
	* cp/call.c (build_addr_func): Call decay_conversion with new
	argument.
	* cp/pt.c (convert_template_argument): Call reject_gcc_builtin.
	* cp/typeck.c (decay_conversion): Use new argument.
	(c_decl_implicit): Define.

gcc/testsuite/ChangeLog
2015-09-03  Martin Sebor  <msebor@redhat.com>

	PR c/66516
	* g++.dg/addr_builtin-1.C: New test.
	* gcc.dg/addr_builtin-1.c: New test.

From-SVN: r227458
2015-09-03 10:23:11 -06:00
Paolo Carlini 82e78c3f28 re PR c++/63693 (ICE in resolve_typename_type)
/cp
2015-08-22  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/63693
	* pt.c (resolve_typename_type): Use CLASSTYPE_PRIMARY_TEMPLATE_TYPE
	only on class types.

/testsuite
2015-08-22  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/63693
	* g++.dg/cpp0x/decltype63.C: New.

From-SVN: r227098
2015-08-22 17:44:46 +00:00
Jason Merrill 8e43da810d DR 1155
DR 1155
	* pt.c (convert_nontype_argument): Allow internal linkage in C++11
	and up.

From-SVN: r226992
2015-08-18 17:29:01 -04:00
Jason Merrill b361a15ff6 re PR c++/67244 (internal compiler error: in gimplify_var_or_parm_decl, at gimplify.c:1801)
PR c++/67244
	* pt.c (tsubst_copy_and_build): Call insert_pending_capture_proxies.

From-SVN: r226950
2015-08-17 14:42:09 -04:00
Jason Merrill 7beb0c35aa re PR c++/67152 ([concepts] bogus "partial specialization of ‘foo<T>’ after instantiation" error)
PR c++/67152
	* pt.c (process_partial_specialization): Call
	associate_classtype_constraints.

From-SVN: r226739
2015-08-08 18:01:39 -04:00
Jason Merrill d6729a4291 re PR c++/67142 ([C++1z] ICE: tree check: expected template_decl, have field_decl in equal, at cp/pt.c:1665)
PR c++/67142
	* pt.c (equal): Make sure tmpl is actually a template.

From-SVN: r226737
2015-08-08 18:01:21 -04:00
Andrew Sutton 971e17ff87 Add C++ Concepts TS support.
gcc/c-family/
	* c-common.c (c_common_reswords): Add __is_same_as, concept, requires.
	* c-common.h (enum rid): Add RID_IS_SAME_AS, RID_CONCEPT, RID_REQUIRES.
	(D_CXX_CONCEPTS, D_CXX_CONCEPTS_FLAGS): New.
	* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_concepts.
	* c-opts.c (set_std_cxx1z): Set flag_concepts.
	* c.opt (fconcepts): New.
gcc/cp/
	* constraint.cc, logic.cc: New files.
	* Make-lang.in (CXX_AND_OBJCXX_OBJS): Add constraint.o and logic.o.
	(c++.tags): Also process .cc files.
	* call.c (enum rejection_reason_code): Add rr_constraint_failure.
	(print_z_candidate): Handle it.
	(constraint_failure): New.
	(add_function_candidate): Check constraints.
	(build_new_function_call): Handle evaluating concepts.
	(joust): Check more_constrained.
	* class.c (add_method): Check equivalently_constrained.
	(build_clone): Copy constraints.
	(currently_open_class): Return tree.
	(resolve_address_of_overloaded_function): Check constraints.
	* constexpr.c (cxx_eval_constant_expression): Handle REQUIRES_EXPR.
	(potential_constant_expression_1): Likewise.
	* cp-objcp-common.c (cp_tree_size): Handle CONSTRAINT_INFO.
	(cp_common_init_ts): Handle WILDCARD_DECL and REQUIRES_EXPR.
	* cp-tree.def: Add CONSTRAINT_INFO, WILDCARD_DECL, REQUIRES_EXPR,
	SIMPLE_REQ, TYPE_REQ, COMPOUND_REQ, NESTED_REQ, PRED_CONSTR,
	EXPR_CONSTR, TYPE_CONSTR, ICONV_CONSTR, DEDUCT_CONSTR,
	EXCEPT_CONSTR, PARM_CONSTR, CONJ_CONSTR, DISJ_CONSTR.
	* cp-tree.h (struct tree_constraint_info, check_nonnull)
	(check_constraint_info, CI_TEMPLATE_REQS, CI_DECLARATOR_REQS)
	(CI_ASSOCIATED_CONSTRAINTS, CI_NORMALIZED_CONSTRAINTS)
	(CI_ASSUMPTIONS, TEMPLATE_PARMS_CONSTRAINTS)
	(TEMPLATE_PARM_CONSTRAINTS, COMPOUND_REQ_NOEXCEPT_P)
	(PLACEHOLDER_TYPE_CONSTRAINTS, PRED_CONSTR_EXPR, EXPR_CONSTR_EXPR)
	(TYPE_CONSTR_TYPE, ICONV_CONSTR_EXPR, ICONV_CONSTR_TYPE)
	(DEDUCT_CONSTR_EXPR, DEDUCT_CONSTR_PATTERN)
	(DEDUCT_CONSTR_PLACEHOLDER, EXCEPT_CONSTR_EXPR, PARM_CONSTR_PARMS)
	(PARM_CONSTR_OPERAND, CONSTRAINT_VAR_P, CONSTRAINED_PARM_CONCEPT)
	(CONSTRAINED_PARM_EXTRA_ARGS, CONSTRAINED_PARM_PROTOTYPE)
	(DECL_DECLARED_CONCEPT_P, WILDCARD_PACK_P, struct cp_unevaluated)
	(struct local_specialization_stack, enum auto_deduction_context)
	(variable_concept_p, concept_template_p)
	(struct deferring_access_check_sentinel): New.
	(enum cp_tree_node_structure_enum): Add TS_CP_CONSTRAINT_INFO.
	(union lang_tree_node): Add constraint_info field.
	(struct lang_decl_base): Add concept_p flag.
	(enum cp_decl_spec): Add ds_concept.
	(struct cp_declarator): Add requires_clause.
	* cxx-pretty-print.c (cxx_pretty_printer::primary_expression)
	(cxx_pretty_printer::expression): Handle REQUIRES_EXPR,
	TRAIT_EXPR, *_CONSTR.
	(pp_cxx_parameter_declaration_clause): Accept a chain of
	PARM_DECLs.
	(cxx_pretty_printer::declarator): Print requires-clause.
	(pp_cxx_template_declaration): Likewise.
	(pp_cxx_trait_expression): Handle CPTK_IS_SAME_AS.
	(pp_cxx_requires_clause, pp_cxx_requirement)
	(pp_cxx_requirement_list, pp_cxx_requirement_body)
	(pp_cxx_requires_expr, pp_cxx_simple_requirement)
	(pp_cxx_type_requirement, pp_cxx_compound_requirement)
	(pp_cxx_nested_requirement, pp_cxx_predicate_constraint)
	(pp_cxx_expression_constraint, pp_cxx_type_constraint)
	(pp_cxx_implicit_conversion_constraint)
	(pp_cxx_argument_deduction_constraint)
	(pp_cxx_exception_constraint, pp_cxx_parameterized_constraint)
	(pp_cxx_conjunction, pp_cxx_disjunction, pp_cxx_constraint): New.
	* cxx-pretty-print.h: Declare them.
	* decl.c (decls_match): Compare constraints.
	(duplicate_decls): Likewise.  Remove constraints before freeing.
	(cxx_init_decl_processing): Call init_constraint_processing.
	(cp_finish_decl): Diagnose concept without initializer.
	(grokfndecl, grokvardecl): Handle concepts and constraints.
	(grokdeclarator): Handle concept, requires-clause.
	(grokparms): No longer static.
	(xref_tag_1): Check constraints.
	(finish_function): Call check_function_concept.
	(cp_tree_node_structure): Handle CONSTRAINT_INFO.
	(check_concept_refinement, is_concept_var, check_concept_fn): New.
	* decl2.c (check_classfn): Compare constraints.
	(mark_used): Don't instantiate concepts.
	* error.c (dump_template_decl): Print constraints.
	(dump_function_decl): Likewise.
	(dump_expr): Handle REQUIRES_EXPR, *_REQ, *_CONSTR.
	* lex.c (init_reswords): Set D_CXX_CONCEPTS.
	* method.c (implicitly_declare_fn): Copy constraints from
	inherited ctor.
	* parser.h (struct cp_parser): Add in_result_type_constraint_p and
	prevent_constrained_type_specifiers fields.
	* parser.c (make_call_declarator): Add requires_clause parm.
	(cp_parser_new): Clear prevent_constrained_type_specifiers.
	(cp_parser_primary_expression): Handle RID_IS_SAME_AS, RID_REQUIRES.
	(cp_parser_postfix_expression): Set prevent_constrained_type_specifiers.
	(cp_parser_trait_expr): Handle RID_IS_SAME_AS.
	(cp_parser_declaration): Handle concept introduction.
	(cp_parser_member_declaration): Likewise.
	(cp_parser_template_parameter): Handle constrained parameter.
	(cp_parser_type_parameter): Handle constraints.
	(cp_parser_decl_specifier_seq): Handle RID_CONCEPT.
	(cp_parser_template_id): Handle partial concept id.
	(cp_parser_type_name): Add overload that takes typename_keyword_p.
	Handle constrained parameter.
	(cp_parser_nonclass_name): Handle concept names.
	(cp_parser_alias_declaration): Handle constraints.
	(cp_parser_late_return_type_opt): Also handle requires-clause.
	(cp_parser_type_id_1): Handle deduction constraint.
	(cp_parser_parameter_declaration): Handle constrained parameters.
	(cp_parser_class_specifier_1): Handle constraints.
	(cp_parser_template_declaration_after_parameters): Split out from
	cp_parser_template_declaration_after_export.
	(cp_parser_single_declaration): Handle constraints.
	(synthesize_implicit_template_parm): Handle constraints.
	(cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id)
	(cp_parser_introduction_list, get_id_declarator)
	(get_unqualified_id, is_constrained_parameter)
	(cp_parser_check_constrained_type_parm)
	(cp_parser_constrained_type_template_parm)
	(cp_parser_constrained_template_template_parm)
	(constrained_non_type_template_parm, finish_constrained_parameter)
	(declares_constrained_type_template_parameter)
	(declares_constrained_template_template_parameter)
	(check_type_concept, cp_parser_maybe_constrained_type_specifier)
	(cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id)
	(cp_parser_requires_clause, cp_parser_requires_clause_opt)
	(cp_parser_requires_expression)
	(cp_parser_requirement_parameter_list, cp_parser_requirement_body)
	(cp_parser_requirement_list, cp_parser_requirement)
	(cp_parser_simple_requirement, cp_parser_type_requirement)
	(cp_parser_compound_requirement, cp_parser_nested_requirement)
	(cp_parser_template_introduction)
	(cp_parser_explicit_template_declaration)
	(get_concept_from_constraint): New.
	* pt.c (local_specialization_stack): Implement.
	(maybe_new_partial_specialization): New.
	(maybe_process_partial_specialization): Use it.
	(retrieve_local_specialization, register_local_specialization)
	(template_parm_to_arg, build_template_decl, extract_fnparm_pack)
	(tsubst_expr): No longer static.
	(spec_hasher::equal): Compare constraints.
	(determine_specialization): Handle constraints.
	(check_explicit_specialization): Handle concepts.
	(process_template_parm): Handle constraints.
	(end_template_parm_list): Add overload taking no arguments.
	(process_partial_specialization): Handle concepts and constraints.
	Register partial specializations of variable templates.
	(redeclare_class_template): Handle constraints.
	(convert_template_argument): Handle WILDCARD_DECL.  Check
	is_compatible_template_arg.
	(coerce_template_parameter_pack): Handle wildcard packs.
	(coerce_template_parms): DR 1430 also applies to concepts.  Add
	overloads taking fewer parameters.
	(lookup_template_class_1): Handle constraints.
	(lookup_template_variable): Concepts are always bool.
	(finish_template_variable): Handle concepts and constraints.
	(tsubst_friend_class): Handle constraints.
	(gen_elem_of_pack_expansion_instantiation): Handle constraints.
	(tsubst_pack_expansion): Handle local parameters.
	(tsubst_decl) [FUNCTION_DECL]: Handle constraints.
	(tsubst) [TEMPLATE_TYPE_PARM]: Handle deduction constraints.
	(tsubst_copy_and_build): Handle REQUIRES_EXPR.
	(more_specialized_fn, more_specialized_partial_spec): Check constraints.
	(more_specialized_inst): Split out from most_specialized_instantiation.
	(most_specialized_partial_spec): Check constraints.
	(instantiate_decl): Never instantiate a concept.
	(value_dependent_expression_p): Handle REQUIRES_EXPR, TYPE_REQ,
	variable concepts.
	(type_dependent_expression_p): Handle WILDCARD_DECL, REQUIRES_EXPR.
	(instantiation_dependent_r): Handle REQUIRES_EXPR and concepts.
	(do_auto_deduction): Add overload taking tsubst flags and context enum.
	Handle constraints.
	(get_template_for_ordering, most_constrained_function)
	(is_compatible_template_arg, convert_wildcard_argument)
	(struct	constr_entry, struct constr_hasher, decl_constraints)
	(valid_constraints_p, get_constraints, set_constraints)
	(remove_constraints, init_constraint_processing): New.
	* ptree.c (cxx_print_xnode): Handle CONSTRAINT_INFO.
	* search.c (lookup_member): Do lookup in the open partial
	instantiation.
	* semantics.c (finish_template_template_parm): Handle constraints.
	(fixup_template_type): New.
	(finish_template_type): Call it.
	(trait_expr_value, finish_trait_expr): Handle CPTK_IS_SAME_AS.
	* tree.c (cp_tree_equal): Handle local parameters, CONSTRAINT_INFO.
	(cp_walk_subtrees): Handle REQUIRES_EXPR.
	* typeck.c (cp_build_function_call_vec): Check constraints.

Co-Authored-By: Braden Obrzut <admin@maniacsvault.net>
Co-Authored-By: Jason Merrill <jason@redhat.com>

From-SVN: r226713
2015-08-07 01:44:49 -04:00
Jason Merrill c1153c1987 re PR c++/67130 (ICE: tree check: expected identifier_node, have template_decl in write_unqualified_id, at cp/mangle.c:1218)
PR c++/67130
	PR c++/67131
	PR c++/66260
	* mangle.c (write_expression) [TEMPLATE_ID_EXPR]: Handle variable
	templates.
	* pt.c (tsubst_copy_and_build): Check for argument substitution
	failure.

From-SVN: r226676
2015-08-06 10:26:18 -04:00
Jason Merrill f31d0b122f pt.c (determine_specialization): Print candidates after 'no match' error.
* pt.c (determine_specialization): Print candidates after 'no
	match' error.

From-SVN: r226653
2015-08-05 21:33:32 -04:00
Jason Merrill a2b4cfaa89 decl.c (cp_finish_decl): Tidy.
* decl.c (cp_finish_decl): Tidy.
	* typeck.c (finish_class_member_access_expr): Use
	type_dependent_expression_p.
	* semantics.c (finish_id_expression): Use
	type_dependent_expression_p.  Don't build_qualified_name for a
	decl in non-dependent scope.
	* pt.c (type_dependent_expression_p): A TEMPLATE_ID_EXPR of an
	identifier is dependent.  Remove variable_template_p check.

From-SVN: r226652
2015-08-05 21:33:27 -04:00
Jason Merrill dc062b4986 re PR c++/66260 ([C++14] Failure to compile variable template with recursively defined partial specialization)
PR c++/66260
	PR c++/66596
	PR c++/66649
	PR c++/66923
	* pt.c (lookup_template_variable): Use NULL_TREE for type.
	(instantiate_template_1): Also set DECL_TI_ARGS based on
	the immediate parent.
	(tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle variable templates.
	(finish_template_variable): Add complain parm.
	* cp-tree.h: Adjust.

From-SVN: r226642
2015-08-05 13:56:14 -04:00
Jason Merrill 3da33383b4 * pt.c (lookup_template_class_1): Clear elt.spec.
From-SVN: r226581
2015-08-04 11:18:45 -04:00
Jason Merrill 4fdfdd4f1b DR 1558 PR c++/67021
DR 1558
	PR c++/67021
	* pt.c (tsubst_decl) [TYPE_DECL]: Clear TYPE_DEPENDENT_P_VALID.

From-SVN: r226381
2015-07-30 01:27:34 -04:00