summaryrefslogtreecommitdiff
path: root/gcc/cp
Commit message (Collapse)AuthorAgeFilesLines
* DR 1155jason2015-08-182-3/+11
| | | | | | | * pt.c (convert_nontype_argument): Allow internal linkage in C++11 and up. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226992 138bc75d-0d04-0410-961f-82ee72b054a4
* /cppaolo2015-08-172-4/+20
| | | | | | | | | | | | | | | | | | | | | 2015-08-17 Paolo Carlini <paolo.carlini@oracle.com> PR c++/67216 * call.c (null_ptr_cst_p): In C++11 return 'false' for 'false'. /testsuite 2015-08-17 Paolo Carlini <paolo.carlini@oracle.com> PR c++/67216 * g++.dg/cpp0x/nullptr34.C: New. * g++.dg/warn/Wconversion2.C: Adjust. * g++.dg/warn/Wnull-conversion-1.C: Likewise. * g++.old-deja/g++.other/null3.C: Likewise. * g++.dg/cpp0x/pr51313.C: Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226956 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/67244jason2015-08-172-0/+5
| | | | | | * pt.c (tsubst_copy_and_build): Call insert_pending_capture_proxies. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226950 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/67104jason2015-08-172-46/+129
| | | | | | | * constexpr.c (array_index_cmp, find_array_ctor_elt): New. (cxx_eval_array_reference, cxx_eval_store_expression): Use them. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226949 138bc75d-0d04-0410-961f-82ee72b054a4
* * constexpr.c (cxx_eval_store_expression): Don't setjason2015-08-172-2/+23
| | | | | | | | CONSTRUCTOR_NO_IMPLICIT_ZERO if we have an enclosing CONSTRUCTOR without it. (cxx_eval_array_reference): Check it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226948 138bc75d-0d04-0410-961f-82ee72b054a4
* * except.c (check_noexcept_r): Assert that fn is POINTER_TYPE_P.jason2015-08-172-1/+7
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226947 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/65974jason2015-08-152-0/+8
| | | | | | * decl2.c (mark_vtable_entries): Suppress -Wdeprecated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226908 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/67104jason2015-08-122-1/+4
| | | | | | * constexpr.c (cxx_eval_array_reference): Fix typo. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226833 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/67104jason2015-08-122-3/+38
| | | | | | | * constexpr.c (cxx_eval_array_reference): Handle sparse CONSTRUCTORs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226830 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/67108jason2015-08-124-1/+14
| | | | | | | * decl2.c (c_parse_final_cleanups): Set at_eof to 2 at end. * error.c (dump_template_bindings): Don't tsubst in that case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226829 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/67161jason2015-08-122-1/+8
| | | | | | | * error.c (dump_decl) [TEMPLATE_ID_EXPR]: Pass TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226827 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/67144jason2015-08-081-1/+1
| | | | | | * call.c (joust): Only call more_constrained on decls. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226740 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/67152jason2015-08-082-0/+6
| | | | | | | * pt.c (process_partial_specialization): Call associate_classtype_constraints. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226739 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/67159jason2015-08-082-0/+5
| | | | | | | * constraint.cc (finish_template_introduction): SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226738 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/67142jason2015-08-082-0/+5
| | | | | | * pt.c (equal): Make sure tmpl is actually a template. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226737 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/67114jason2015-08-082-8/+13
| | | | | | * call.c (joust): Only call more_constrained on decls. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226736 138bc75d-0d04-0410-961f-82ee72b054a4
* villejason2015-08-071-0/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226716 138bc75d-0d04-0410-961f-82ee72b054a4
* Add C++ Concepts TS support.jason2015-08-0725-242/+6542
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226713 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/66533jason2015-08-062-1/+6
| | | | | | | * parser.c (cp_parser_primary_expression): Don't skip to the end of the statement if we're parsing tentatively. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226684 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/67130jason2015-08-063-1/+15
| | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226676 138bc75d-0d04-0410-961f-82ee72b054a4
* * pt.c (determine_specialization): Print candidates after 'nojason2015-08-062-0/+7
| | | | | | match' error. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226653 138bc75d-0d04-0410-961f-82ee72b054a4
* * decl.c (cp_finish_decl): Tidy.jason2015-08-065-89/+29
| | | | | | | | | | | | * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226652 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/66260jason2015-08-053-4/+26
| | | | | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226642 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/65195jason2015-08-052-0/+8
| | | | | | | | PR c++/66619 * semantics.c (finish_id_expression): Call convert_from_reference for variable template. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226641 138bc75d-0d04-0410-961f-82ee72b054a4
* * pt.c (lookup_template_class_1): Clear elt.spec.jason2015-08-042-0/+3
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226581 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree.c (build_target_expr): Copy the location from value.jason2015-08-042-0/+6
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226580 138bc75d-0d04-0410-961f-82ee72b054a4
* Refactor entry point to -Wmisleading-indentationppalka2015-08-022-57/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gcc/c-family/ChangeLog: * c-indentation.h (struct token_indent_info): Define. (get_token_indent_info): Define. (warn_for_misleading_information): Declare. * c-common.h (warn_for_misleading_information): Remove. * c-identation.c (warn_for_misleading_indentation): Change declaration to take three token_indent_infos. Adjust accordingly. * c-identation.c (should_warn_for_misleading_indentation): Likewise. Bail out early if the body is a compound statement. (guard_tinfo_to_string): Define. gcc/c/ChangeLog: * c-parser.c (c_parser_if_body): Take token_indent_info argument. Call warn_for_misleading_indentation even when the body is a semicolon. Extract token_indent_infos corresponding to the guard, body and next tokens. Adjust call to warn_for_misleading_indentation accordingly. (c_parser_else_body): Likewise. (c_parser_if_statement): Likewise. (c_parser_while_statement): Likewise. (c_parser_for_statement): Likewise. gcc/cp/ChangeLog: * parser.c (cp_parser_selection_statement): Move handling of semicolon body to ... (cp_parser_implicitly_scoped_statement): .. here. Call warn_for_misleading_indentation even when the body is a semicolon. Extract token_indent_infos corresponding to the guard, body and next tokens. Adjust call to warn_for_misleading_indentation accordingly. Take token_indent_info argument. (cp_parser_already_scoped_statement): Likewise. (cp_parser_selection_statement, cp_parser_iteration_statement): Extract a token_indent_info corresponding to the guard token. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226477 138bc75d-0d04-0410-961f-82ee72b054a4
* Fix PR 66521ctice2015-08-022-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libvtv/ChangeLog 2015-08-01 Caroline Tice <cmtice@google.com> PR 66521 * Makefile.am: Update to match latest tree. * Makefile.in: Regenerate. * testsuite/lib/libvtv: Brought up to date. * vtv_malloc.cc (VTV_DEBUG): Update function call to match renamed function (old bug!). * vtv_rts.cc (debug_functions, debug_init, debug_verify_vtable): Update initializations to work correctly with VTV_DEBUG defined. gcc/ChangeLog: 2015-08-01 Caroline Tice <cmtice@google.com> PR 66521 * vtable-verify.c (vtbl_mangled_name_types, vtbl_mangled_name_ids): New global variables. (vtbl_find_mangled_name): New function. (vtbl_register_mangled_name): New function. (vtbl_map_get_node): If DECL_ASSEMBLER_NAME is "<anon>", look up mangled name in mangled name vectors. (find_or_create_vtbl_map_node): Ditto. (var_is_used_for_virtual_call_p): Add recursion_depth parameter; update recursion_depth on function entry; pass it to every recursive call; automatically exit if depth > 25 (give up looking at that point). (verify_bb_vtables): Initialize recursion_depth and pass it to var_is_used_for_virtual_call_p. * vtable-verify.h (vtbl_mangbled_name_types, vtbl_mangled_name_ids): New global variable decls. (vtbl_register_mangled_name): New extern function decl. gcc/cp/ChangeLog: 2015-08-01 Caroline Tice <cmtice@google.com> PR 66521 * mangle.c : Add vtable-verify.h to include files. (get_mangled_vtable_map_var_name): If the DECL_ASSEMBLER_NAME is "<anon>" get the real mangled name for the class instead, and also store the real mangled name in a vector for use later. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226471 138bc75d-0d04-0410-961f-82ee72b054a4
* PR sanitizer/66977mpolacek2015-07-312-0/+13
| | | | | | | | | | * typeck.c (get_member_function_from_ptrfunc): Don't sanitize RSHIFT_EXPR. * g++.dg/ubsan/pr66977.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226440 138bc75d-0d04-0410-961f-82ee72b054a4
* 2015-07-30 Paolo Carlini <paolo.carlini@oracle.com>paolo2015-07-303-50/+83
| | | | | | | | | | | | | | | | | | | | * class.c (check_for_override): Use DECL_SOURCE_LOCATION and "%qD" in warning_at instead of "%q+D" in warning. (warn_hidden): Likewise but use location_of. (finish_struct_anon_r): Likewise use DECL_SOURCE_LOCATION in permerror. (check_bitfield_decl, check_field_decls): Likewise in warning_at. (check_field_decls): Likewise for permerror. (explain_non_literal_class): Likewise for inform. (check_bases_and_members, layout_class_type): Likewise for warning_at. (note_name_declared_in_class): Use location_of in permerror. * name-lookup.c (diagnose_name_conflict): Use location_of in inform. (pushdecl_maybe_friend_1): Use DECL_SOURCE_LOCATION in pedwarn, inform, and warning_at. (check_for_out_of_scope_variable): Likewise for warning_at and permerror. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226394 138bc75d-0d04-0410-961f-82ee72b054a4
* DR 1558jason2015-07-302-0/+10
| | | | | | | PR c++/67021 * pt.c (tsubst_decl) [TYPE_DECL]: Clear TYPE_DEPENDENT_P_VALID. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226381 138bc75d-0d04-0410-961f-82ee72b054a4
* 2015-07-28 Paolo Carlini <paolo.carlini@oracle.com>paolo2015-07-2812-47/+88
| | | | | | | | | | | | | | | | | | | | | | | * call.c (build_op_delete_call, convert_like_real, build_over_call): Use Use DECL_SOURCE_LOCATION and "%qD" in inform and pedwarn instead of "%q+D". * constexpr.c (explain_invalid_constexpr_fn): Likewise. * decl.c (duplicate_decls): Likewise for warning/warning_at. * except.c (maybe_noexcept_warning): Likewise. * friend.c (make_friend_class): Likewise for inform. * mangle.c (mangle_decl): Likewise for warning/warning_at. * method.c (process_subob_fn, walk_field_subobs, maybe_explain_implicit_delete): Likewise for inform. * parser.c (cp_parser_lambda_introducer): Likewise. * pt.c (check_specialization_namespace, maybe_process_partial_specialization): Likewise for permerror. (redeclare_class_template): Likewise for inform_n. (coerce_template_parms, tsubst_copy_and_build): Likewise for inform. * search.c (check_final_overrider): Likewise. * semantics.c (process_outer_var_ref): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226308 138bc75d-0d04-0410-961f-82ee72b054a4
* * constexpr.c (cxx_eval_call_expression): Don't add this call tojason2015-07-272-1/+6
| | | | | | the hash table if !depth_ok. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226256 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/66555mpolacek2015-07-273-0/+11
| | | | | | | | | | | | | | | | | | | | | PR c/54979 * c-common.c (find_array_ref_with_const_idx_r): New function. (warn_tautological_cmp): New function. * c-common.h (warn_tautological_cmp): Declare. * c.opt (Wtautological-compare): New option. * c-typeck.c (parser_build_binary_op): Call warn_tautological_cmp. * call.c (build_new_op_1): Call warn_tautological_cmp. * pt.c (tsubst_copy_and_build): Use sentinel to suppress tautological compare warnings. * doc/invoke.texi: Document -Wtautological-compare. * c-c++-common/Wtautological-compare-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226242 138bc75d-0d04-0410-961f-82ee72b054a4
* Fix PR c++/18969 (invalid return statement diagnosed too late)ppalka2015-07-262-6/+23
| | | | | | | | | | | | | | | | | | | | | gcc/cp/ChangeLog: PR c++/18969 * typeck.c (check_return_expr): Also do the basic return-value validity checking if processing_template_decl and yet types are not dependent. Remove obsolete code. gcc/testsuite/ChangeLog: PR c++/18969 * g++.dg/template/pr18969.C: New test. * g++.dg/template/pr18969-2.C: New test. * g++.old-deja/g++.jason/overload.C: Remove return value in template function returning void. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226236 138bc75d-0d04-0410-961f-82ee72b054a4
* 2015-07-26 Paolo Carlini <paolo.carlini@oracle.com>paolo2015-07-266-53/+96
| | | | | | | | | | | | | | | | | | | | * decl.c (poplevel): Use Use DECL_SOURCE_LOCATION and "%qD" in warning_at instead of "%q+D" in warning. (warn_extern_redeclared_static): Likewise for inform. (check_redeclaration_no_default_args): Likewise for permerror. (duplicate_decls): Likewise. (check_previous_goto_1): Likewise for inform. (check_goto, start_decl, check_for_uninitialized_const_var, start_preparsed_function, finish_function§): Likewise. * decl2.c (build_anon_union_vars, c_parse_final_cleanups): Likewise. * init.c (sort_mem_initializers): Likewise. * typeck.c (convert_for_initialization): Likewise for inform. (maybe_warn_about_returning_address_of_local): Likewise. * typeck2.c (abstract_virtuals_error_sfinae): Likewise for inform. (cxx_incomplete_type_diagnostic): Likewise for emit_diagnostic. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226234 138bc75d-0d04-0410-961f-82ee72b054a4
* Fix PR c++/66857ppalka2015-07-252-1/+8
| | | | | | | | | | | | | | | | | gcc/cp/ChangeLog: PR c++/66857 * cvt.c (ocp_convert): Don't call scalar_constant_value when converting to a class type. gcc/testsuite/ChangeLog: PR c++/66857 * g++.dg/init/pr66857.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226228 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/64969jason2015-07-251-1/+1
| | | | | | | * pt.c (splice_late_return_type): Correct deduced return type for abbreviated function template. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226208 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/64989jason2015-07-252-8/+18
| | | | | | | * pt.c (splice_late_return_type): Correct deduced return type for abbreviated function template. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226207 138bc75d-0d04-0410-961f-82ee72b054a4
* 2015-07-24 Richard Biener <rguenther@suse.de>rguenth2015-07-242-1/+7
| | | | | | | | | | | | | * fold-const.c (maybe_canonicalize_comparison_1): Move A code CST canonicalization ... * match.pd: ... to a pattern here. cp/ * init.c (build_vec_init): Build iterator bound in the same type as the iterator. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226143 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/66572mpolacek2015-07-232-0/+6
| | | | | | | | | * pt.c (tsubst_copy_and_build): Add warn_logical_op sentinel. * g++.dg/warn/Wlogical-op-2.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226120 138bc75d-0d04-0410-961f-82ee72b054a4
* /cppaolo2015-07-232-1/+8
| | | | | | | | | | | | | | | | | | 2015-07-23 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52987 * parser.c (cp_parser_simple_declaration): Robustify check avoiding redundant error messages. /testsuite 2015-07-23 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52987 * g++.dg/parse/error57.C: New. * g++.dg/expr/string-2.C: Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226097 138bc75d-0d04-0410-961f-82ee72b054a4
* /cppaolo2015-07-212-1/+11
| | | | | | | | | | | | | | | 2015-07-21 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (grokdeclarator): For an erroneous template parameter propagate error_mark_node as type. /testsuite 2015-07-21 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/template/crash81.C: Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226054 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/55095mpolacek2015-07-202-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * c-common.c (c_fully_fold_internal): Warn about left shift overflows. Use EXPR_LOC_OR_LOC. (maybe_warn_shift_overflow): New function. * c-common.h (maybe_warn_shift_overflow): Declare. * c-opts.c (c_common_post_options): Set warn_shift_overflow. * c.opt (Wshift-overflow): New option. * c-typeck.c (digest_init): Pass OPT_Wpedantic to pedwarn_init. (build_binary_op): Warn about left shift overflows. * typeck.c (cp_build_binary_op): Warn about left shift overflows. * doc/invoke.texi: Document -Wshift-overflow and -Wshift-overflow=. * c-c++-common/Wshift-overflow-1.c: New test. * c-c++-common/Wshift-overflow-2.c: New test. * c-c++-common/Wshift-overflow-3.c: New test. * c-c++-common/Wshift-overflow-4.c: New test. * c-c++-common/Wshift-overflow-5.c: New test. * g++.dg/cpp1y/left-shift-1.C: New test. * gcc.dg/c90-left-shift-2.c: New test. * gcc.dg/c90-left-shift-3.c: New test. * gcc.dg/c99-left-shift-2.c: New test. * gcc.dg/c99-left-shift-3.c: New test. * gcc.dg/pr40501.c: Use -Wno-shift-overflow. * gcc.c-torture/execute/pr40386.c: Likewise. * gcc.dg/vect/pr33373.c: Likewise. * gcc.dg/vect/vect-shift-2-big-array.c: Likewise. * gcc.dg/vect/vect-shift-2.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225998 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/65091jason2015-07-152-2/+15
| | | | | | | * parser.c (cp_parser_unqualified_id): Don't accept ~x in a template if there is no type x in scope. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225831 138bc75d-0d04-0410-961f-82ee72b054a4
* Fix PR c++/66850ppalka2015-07-152-3/+31
| | | | | | | | | | | | | | | | | | | | gcc/cp/ChangeLog: PR c++/66850 * pt.c (redeclare_class_template): Set the DECL_CONTEXTs of each template template parm in the redeclaration. (lookup_template_class_1): Peel off irrelevant template levels from current_template_parms before augmenting the argument list. gcc/testsuite/ChangeLog: PR c++/66850 * g++.dg/template/pr66850.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225801 138bc75d-0d04-0410-961f-82ee72b054a4
* /cppaolo2015-07-142-1/+7
| | | | | | | | | | | | | | | | | 2015-07-14 Andrea Azzarone <azzaronea@gmail.com> PR c++/65071 * parser.c (cp_parser_sizeof_pack): Also consider template template parameters. /testsuite 2015-07-14 Andrea Azzarone <azzaronea@gmail.com> PR c++/65071 * g++.dg/cpp0x/vt-65071.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225793 138bc75d-0d04-0410-961f-82ee72b054a4
* * call.c (build_new_method_call_1): Call reshape_init.jason2015-07-142-1/+8
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225784 138bc75d-0d04-0410-961f-82ee72b054a4
* /cppaolo2015-07-142-2/+12
| | | | | | | | | | | | | | | | | | | | | | 2015-07-14 Paolo Carlini <paolo.carlini@oracle.com> * pt.c (check_template_shadow): Emit error + inform instead of two errors. /testsuite 2015-07-14 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/template/crash81.C: Adjust for error + inform change. * g++.dg/template/pr58878.C: Likewise. * g++.dg/template/shadow1.C: Likewise. * g++.dg/template/shadow2.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Likewise. * g++.old-deja/g++.benjamin/tem04.C: Likewise. * g++.old-deja/g++.brendan/crash7.C: Likewise. * g++.old-deja/g++.pt/shadow2.C: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225783 138bc75d-0d04-0410-961f-82ee72b054a4
* Fix PR c++/65186ppalka2015-07-132-0/+11
| | | | | | | | | | | | | | | | gcc/cp/ChangeLog: PR c++/65186 * pt.c (invalid_nontype_parm_type_p): Accept a bound template template parm type under C++11 and later. gcc/testsuite/ChangeLog: PR c++/65186 * g++.dg/template/pr65186.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225749 138bc75d-0d04-0410-961f-82ee72b054a4