aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
AgeCommit message (Collapse)AuthorFilesLines
2011-07-19re PR c++/49785 ([C++0x] ICE in coerce_template_parms)Jason Merrill1-9/+13
PR c++/49785 * pt.c (coerce_template_parms): Handle non-pack after pack. From-SVN: r176472
2011-07-16pt.c (tinst_level_tick, [...]): Replace with last_error_tinst_level.Jason Merrill1-9/+9
gcc/cp/ * pt.c (tinst_level_tick, last_template_error_tick): Replace with last_error_tinst_level. (push_tinst_level, pop_tinst_level): Adjust. (problematic_instantiation_changed): Adjust. (record_last_problematic_instantiation): Adjust. * error.c (cp_print_error_function): Don't print current_function_decl if we're in a template instantiation context. (print_instantiation_full_context): Always print first line. gcc/testsuite/ * lib/prune.exp (prune_gcc_output): Prune "In substitution" too. From-SVN: r176366
2011-07-16re PR c++/45329 (When printing a list of candidate functions, explain why ↵Nathan Froyd1-182/+501
each function failed to match.) PR c++/45329 PR c++/48934 * cp-tree.h (fn_type_unification): Add `bool' parameter. * pt.c (enum template_base_result): Define. (unify_success, unify_unknown): Define. (unify_parameter_deduction_failure): Define. (unify_invalid, unify_cv_qual_mismatch, unify_type_mismatch): Define. (unify_parameter_pack_mismatch): Define. (unify_parameter_pack_inconsistent): Define. (unify_ptrmem_cst_mismatch, unify_vla_arg): Define. (unify_expression_unequal, unify_inconsistency): Define. (unify_method_type_error, unify_arity): Likewise. (unify_too_many_parameters, unify_too_few_parameters): Define. (unify_arg_conversion, unify_no_common_base): Define. (unify_illformed_ptrmem_cst_expr): Define. (unify_substitution_failure): Define. (unify_inconsistent_template_template_parameters): Define. (unify_template_deduction_failure): Define. (unify_template_argument_mismatch): Define. (unify_overload_resolution_failure): Define. (comp_template_args_with_info): New function, split out from... (comp_template_args): ...here. Call it. (deduction_tsubst_fntype): Add `complain' parameter'. Pass it to tsubst. (unify): Add `explain_p' parameter. Pass to all relevant calls. Call above status functions when appropriate. (resolve_overloaded_unification, try_one_overload): Likewise. (type_unification, type_unification_real): Likewise. (unify_pack_expansion): Likewise. (get_template_base, try_class_unification): Likewise. (get_bindings, more_specialized_fn): Pass false to unification calls. (get_class_bindings, do_auto_deduction): Likewise. (convert_nontype_argument): Likewise. (fn_type_unification): Likewise. Pass tf_warning_or_error if explain_p. (get_template_base): Add `explain_p' parameter and pass it to try_class_unification. Return an enum template_base_result. * class.c (resolve_address_of_overloaded_function): Pass false to fn_type_unification. * call.c (enum rejection_reason_code): Add new codes. (struct rejection_reason): Add template_unification field. Add template_instantiation field. (template_unification_rejection): Define. (template_unification_error_rejection): Define. (template_instantiation_rejection): Define. (invalid_copy_with_fn_template_rejection): Define. (add_template_candidate): Pass false to unify. Provide more rejection reasons when possible. (print_template_unification_rejection): Define. (print_arity_rejection): Define, split out from... (print_z_candidate): ...here. Add cases for new rejection reasons. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r176365
2011-07-12name-lookup.h (cp_binding_level): Rename from cxx_scope.Diego Novillo1-1/+1
* name-lookup.h (cp_binding_level): Rename from cxx_scope. Update all users. (struct cp_binding_level): Fix indentation. From-SVN: r176218
2011-07-12s/recurson/recursion/Jason Merrill1-2/+2
From-SVN: r176217
2011-07-11re PR c++/49672 ([C++0x] Internal error when passing variadic template args ↵Jason Merrill1-18/+36
to a lambda function) PR c++/49672 * pt.c (extract_fnparm_pack): Split out from... (make_fnparm_pack): ...here. (instantiate_decl): Handle non-pack parms after a pack. * semantics.c (maybe_add_lambda_conv_op): Don't in a template. From-SVN: r176183
2011-07-11re PR c++/44609 (Invalid template code causes infinite loop of error messages)Jason Merrill1-0/+39
PR c++/44609 * cp-tree.h (struct tinst_level): Add errors field. * pt.c (neglectable_inst_p, limit_bad_template_recurson): New. (push_tinst_level): Don't start another decl in that case. (reopen_tinst_level): Adjust errors field. * decl2.c (cp_write_global_declarations): Don't complain about undefined inline if its template was defined. * mangle.c (mangle_decl_string): Handle failure from push_tinst_level. From-SVN: r176176
2011-07-07re PR c++/49663 ([C++0x] ICE in lookup_base)Jason Merrill1-3/+9
PR c++/49663 * pt.c (push_deduction_access_scope): Preserve processing_template_decl across push_to_top_level. And revert: * class.c (pushclass): Accept NULL argument. (popclass): Deal with popping null class. * pt.c (push_access_scope, pop_access_scope): Use them rather than push_to_top_level/pop_from_top_level. * name-lookup.c (lookup_name_real_1): Check current_class_type. From-SVN: r176013
2011-07-06re PR c++/48157 (Unable to match function call to member function template)Jason Merrill1-2/+6
PR c++/48157 * pt.c (tsubst_qualified_id): Preserve TEMPLATE_ID_EXPR in partial instantiation. From-SVN: r175904
2011-07-04error.c (dump_template_bindings): Don't print typenames for a partial ↵Jason Merrill1-1/+1
instantiation. * error.c (dump_template_bindings): Don't print typenames for a partial instantiation. (dump_function_decl): If we aren't printing function arguments, print template arguments as <args> rather than [with ...]. (dump_expr): Don't print return type or template header. [BASELINK]: Use BASELINK_FUNCTIONS rather than get_first_fn. * pt.c (dependent_template_arg_p): Handle null arg. From-SVN: r175834
2011-07-01re PR c++/48261 (internal compiler error: in lookup_template_function, at ↵Jason Merrill1-2/+6
cp/pt.c:6227) PR c++/48261 * pt.c (lookup_template_function): Handle non-function. From-SVN: r175766
2011-07-01re PR c++/48593 (Wrong return type when applying address operator to ↵Jason Merrill1-1/+1
inherited, template dependend member, using a typedef) PR c++/48593 * pt.c (tsubst_qualified_id): Check PTRMEM_OK_P. * tree.c (build_qualified_name): Set PTRMEM_OK_P. * semantics.c (finish_parenthesized_expr): Clear PTRMEM_OK_P on SCOPE_REF, too. * cp-tree.h (PTRMEM_OK_P): Apply to SCOPE_REF, too. (QUALIFIED_NAME_IS_TEMPLATE): Switch to lang flag 1. From-SVN: r175765
2011-07-01re PR c++/48883 (?: ternary operator fails in certain contexts - link error)Jason Merrill1-0/+1
PR c++/48883 PR c++/49609 * pt.c (resolve_nondeduced_context): Call mark_used. From-SVN: r175764
2011-06-30* pt.c (iterative_hash_template_arg): Use cp_tree_operand_length.Jason Merrill1-1/+1
From-SVN: r175737
2011-06-29pt.c (tsubst_decl): In unevaluated operand, don't tsubst DECL_INITIAL unless ↵Jason Merrill1-5/+4
our type use auto. * pt.c (tsubst_decl) [VAR_DECL]: In unevaluated operand, don't tsubst DECL_INITIAL unless our type use auto. From-SVN: r175670
2011-06-29re PR c++/49554 ([C++0x] lambda capture causes "cannot call member function ↵Jason Merrill1-0/+2
... without object") PR c++/49554 * semantics.c (lambda_proxy_type): New. (build_capture_proxy): Use it. * cp-tree.h (DECLTYPE_FOR_LAMBDA_PROXY): New. * pt.c (tsubst) [DECLTYPE_TYPE]: Use them. From-SVN: r175657
2011-06-23re PR c++/35255 ([DR 115] gcc does not do partial ordering on overloaded ↵Jason Merrill1-1/+10
address resolution) PR c++/35255 * pt.c (resolve_overloaded_unification): Fix DR 115 handling. From-SVN: r175367
2011-06-23re PR c++/36435 (Partial ordering of explicit specialization should include ↵Jason Merrill1-4/+4
return type) PR c++/36435 * pt.c (most_specialized_instantiation): Do check return types. From-SVN: r175338
2011-06-21call.c (add_builtin_candidates): Use cv_unqualified rather than ↵Jason Merrill1-1/+1
TYPE_MAIN_VARIANT. * call.c (add_builtin_candidates): Use cv_unqualified rather than TYPE_MAIN_VARIANT. * pt.c (tsubst_arg_types): Likewise. * except.c (build_throw): Use cv_unqualified. From-SVN: r175272
2011-06-20re PR c++/48138 (__attribute__((aligned)) should give an error when applied ↵Jason Merrill1-4/+27
to a typedef or template parameter, at least in C++0x mode.) PR c++/48138 * pt.c (canonicalize_type_argument): New. (convert_template_argument, unify): Use it. From-SVN: r175236
2011-06-20re PR c++/43321 ([c++0x] ICE on valid auto)Jason Merrill1-5/+11
PR c++/43321 * semantics.c (describable_type): Remove. * cp-tree.h: Likewise. * decl.c (cp_finish_decl): Don't call it. * init.c (build_new): Likewise. * parser.c (cp_parser_omp_for_loop): Likewise. * pt.c (tsubst_decl): Likewise. (do_auto_deduction): If we fail in a template, try again at instantiation time. From-SVN: r175212
2011-06-17re PR c++/43912 ([C++0x] lambda debug info does not describe captured variables)Jason Merrill1-1/+2
PR c++/43912 Generate proxy VAR_DECLs for better lambda debug info. * cp-tree.h (FUNCTION_NEEDS_BODY_BLOCK): Add lambda operator(). (LAMBDA_EXPR_PENDING_PROXIES): New. (struct tree_lambda_expr): Add pending_proxies. * name-lookup.c (pushdecl_maybe_friend_1): Handle capture shadowing. (qualify_lookup): Use is_lambda_ignored_entity. * parser.c (cp_parser_lambda_expression): Don't adjust field names. Call insert_pending_capture_proxies. (cp_parser_lambda_introducer): Use this_identifier. (cp_parser_lambda_declarator_opt): Call the object parameter of the op() "__closure" instead of "this". (cp_parser_lambda_body): Call build_capture_proxy. * semantics.c (build_capture_proxy, is_lambda_ignored_entity): New. (insert_pending_capture_proxies, insert_capture_proxy): New. (is_normal_capture_proxy, is_capture_proxy): New. (add_capture): Add __ to field names here, return capture proxy. (add_default_capture): Use this_identifier, adjust to expect add_capture to return a capture proxy. (outer_lambda_capture_p, thisify_lambda_field): Remove. (finish_id_expression, lambda_expr_this_capture): Adjust. (build_lambda_expr): Initialize LAMBDA_EXPR_PENDING_PROXIES. * pt.c (tsubst_copy_and_build): Check that LAMBDA_EXPR_PENDING_PROXIES is null. From-SVN: r175158
2011-06-17parser.c (cp_parser_lambda_expression): Clear LAMBDA_EXPR_THIS_CAPTURE after ↵Jason Merrill1-2/+1
parsing. * parser.c (cp_parser_lambda_expression): Clear LAMBDA_EXPR_THIS_CAPTURE after parsing. * pt.c (tsubst_copy_and_build): Make sure it isn't set. From-SVN: r175156
2011-06-17pt.c (tsubst_decl): Handle DECL_VALUE_EXPR on reference.Jason Merrill1-0/+5
* pt.c (tsubst_decl): Handle DECL_VALUE_EXPR on reference. * decl.c (check_initializer): Handle DECL_VALUE_EXPR_P. From-SVN: r175153
2011-06-16re PR c++/49229 ([C++0x][SFINAE] ICE with variadics and depending non-type ↵Jason Merrill1-0/+2
default parameter) PR c++/49229 * pt.c (tsubst_decl) [FUNCTION_DECL]: Handle substitution failure. From-SVN: r175120
2011-06-14re PR c++/49107 ([C++0x][4.7 Regression] incomplete type regression with ↵Jason Merrill1-16/+38
std::pair) PR c++/49107 * cp-tree.h (DEFERRED_NOEXCEPT_SPEC_P): Handle overload. * method.c (defaulted_late_check): Only maybe_instantiate_noexcept if the declaration had an exception-specifier. (process_subob_fn): Don't maybe_instantiate_noexcept. * pt.c (maybe_instantiate_noexcept): Handle overload. * typeck2.c (nothrow_spec_p_uninst): New. (merge_exception_specifiers): Add 'fn' parm. Build up overload. * typeck.c (merge_types): Adjust. From-SVN: r175073
2011-06-14pt.c (deduction_tsubst_fntype): Don't save input_location.Jason Merrill1-4/+0
* pt.c (deduction_tsubst_fntype): Don't save input_location. (maybe_instantiate_noexcept): Likewise. From-SVN: r175072
2011-06-10re PR c++/49118 (Endless operator-> chain causes infinite loop)David Krauss1-1/+1
PR c++/49118 * typeck2.c (build_x_arrow): Push fake template context to produce diagnostic on acyclic endless operator-> drill-down. * call.c (build_new_op): Change Boolean overload status value to a pointer to the overload function. * cp-tree.h: Likewise. * typeck.c: Likewise. * parser.c: Likewise. * decl2.c: Likewise. * pt.c: Likewise. From-SVN: r174889
2011-06-09* pt.c (build_non_dependent_expr): Use fold_non_dependent_expr_sfinae.Jason Merrill1-1/+1
From-SVN: r174883
2011-06-08re PR c++/49107 ([C++0x][4.7 Regression] incomplete type regression with ↵Jason Merrill1-7/+76
std::pair) PR c++/49107 * cp-tree.def (DEFERRED_NOEXCEPT): New. * cp-tree.h (struct tree_deferred_noexcept): New. (DEFERRED_NOEXCEPT_PATTERN, DEFERRED_NOEXCEPT_ARGS): New. (DEFERRED_NOEXCEPT_SPEC_P): New. (enum cp_tree_node_structure_enum): Add TS_CP_DEFERRED_NOEXCEPT. (union lang_tree_node): Add tree_deferred_noexcept. (maybe_instantiate_noexcept): Declare. * cp-objcp-common.c (cp_tree_size): Handle DEFERRED_NOEXCEPT. * error.c (dump_exception_spec): Likewise. * cxx-pretty-print.c (pp_cxx_exception_specification): Likewise. * ptree.c (cxx_print_xnode): Likewise. * tree.c (cp_tree_equal): Likewise. * decl.c (cp_tree_node_structure): Likewise. (duplicate_decls): Call maybe_instantiate_noexcept. * except.c (build_noexcept_spec): Handle DEFERRED_NOEXCEPT. (nothrow_spec_p, type_noexcept_p, type_throw_all_p): Check DEFERRED_NOEXCEPT_SPEC_P. * typeck2.c (merge_exception_specifiers): Likewise. * decl2.c (mark_used): Call maybe_instantiate_noexcept. * method.c (process_subob_fn, defaulted_late_check): Likewise. * pt.c (tsubst_exception_specification): Add defer_ok parm. Build DEFERRED_NOEXCEPT. (maybe_instantiate_noexcept): New. (tsubst, regenerate_decl_from_template, instantiate_decl): Adjust. * search.c (check_final_overrider): Call maybe_instantiate_noexcept. From-SVN: r174820
2011-06-08pt.c (deduction_tsubst_fntype): Don't free the tinst entry if a ↵Jason Merrill1-1/+4
pending_template entry is pointing at it. * pt.c (deduction_tsubst_fntype): Don't free the tinst entry if a pending_template entry is pointing at it. From-SVN: r174807
2011-06-07re PR c++/48969 (ICE with -std=c++0x)Jason Merrill1-124/+28
PR c++/48969 PR c++/44175 gcc/c-family/ * c-common.c (max_tinst_depth): Lower default to 900. gcc/cp/ * error.c (subst_to_string): New. (cp_printer): Use it for 'S'. (print_instantiation_partial_context_line): Handle subst context. * pt.c (push_tinst_level): Handle subst context. (deduction_tsubst_fntype): Don't track specific substitutions. Use push_tinst_level. From-SVN: r174772
2011-06-07pt.c (deduction_tsubst_fntype): Use push_deduction_access_scope.Jason Merrill1-7/+11
* pt.c (deduction_tsubst_fntype): Use push_deduction_access_scope. (fn_type_unification): Don't call push_deduction_access_scope here. From-SVN: r174771
2011-06-01pt.c (build_non_dependent_expr): Remove special handling of REFERENCE_REF_P.Jason Merrill1-6/+0
* pt.c (build_non_dependent_expr): Remove special handling of REFERENCE_REF_P. From-SVN: r174545
2011-06-01re PR c++/44175 ([C++0x] decltype sometimes cannot recurse)Jason Merrill1-1/+27
PR c++/44175 * pt.c (template_args_equal): Handle one arg being NULL_TREE. (deduction_tsubst_fntype): Handle excessive non-infinite recursion. From-SVN: r174543
2011-05-27re PR c++/47687 ([C++0x] Crash on a lambda returning a lambda (using ↵Jason Merrill1-2/+9
std::function)) PR c++/47687 * pt.c (dependent_type_p_r): Avoid infinite recursion. From-SVN: r174354
2011-05-27re PR c++/49181 ([C++0x] Error reporting routines re-entered)Jason Merrill1-4/+4
PR c++/49181 * pt.c (get_mostly_instantiated_function_type): Use push_access_scope. From-SVN: r174352
2011-05-27re PR c++/47721 ([C++0x] Updated friendship rules?)Jason Merrill1-1/+2
PR c++/47721 * parser.c (cp_parser_member_declaration): Allow friend T. * friend.c (make_friend_class): Ignore non-classes. * pt.c (instantiate_class_template_1): Handle TEMPLATE_TYPE_PARM. From-SVN: r174319
2011-05-27DR 1004Jason Merrill1-1/+3
DR 1004 * pt.c (convert_template_argument): Don't complain about using injected-class-name as template template argument. From-SVN: r174318
2011-05-27re PR c++/47956 ([C++0x] gcc accepts static data member declaration with ↵Jason Merrill1-2/+0
initializer for non-const literal type if type-specifier is auto) PR c++/47956 * decl.c (check_static_variable_definition): Now static. (cp_finish_decl): Call it here. (grokdeclarator): Not here. * pt.c (instantiate_class_template_1): Or here. * cp-tree.h: Don't declare it. From-SVN: r174317
2011-05-26re PR c++/48424 (C++0x parameter packs expansion problem)Jason Merrill1-3/+16
PR c++/48424 * decl.c (grokparms): Function parameter packs don't need to go at the end. * pt.c (type_unification_real): But they aren't deduced otherwise. From-SVN: r174285
2011-05-25re PR c++/45698 (C++0x Variadic Templates: Infinite template recursion ↵Jason Merrill1-0/+3
rather than an error message) PR c++/45698 * pt.c (dependent_template_arg_p): See through ARGUMENT_PACK_SELECT. From-SVN: r174229
2011-05-25re PR c++/46245 ([C++0x] rejects function with late-specified return type as ↵Jason Merrill1-1/+6
a non-type template parameter) PR c++/46245 * decl.c (grokdeclarator): Complain later for auto parameter. * pt.c (splice_late_return_type): Handle use in a template type-parameter. From-SVN: r174227
2011-05-25re PR c++/45080 ([C++0x] Rejects lambda to function pointer conversion ↵Jason Merrill1-0/+3
inside function template) PR c++/45080 * pt.c (instantiate_class_template_1): Call maybe_add_lambda_conv_op. * semantics.c (lambda_function): Check COMPLETE_OR_OPEN_TYPE_P. From-SVN: r174203
2011-05-25re PR c++/48292 ([C++0x] "sorry, unimplemented: use of 'type_pack_expansion' ↵Jason Merrill1-5/+10
in template") PR c++/48292 * pt.c (tsubst_decl) [PARM_DECL]: Handle partial instantiation of function parameter pack. (tsubst_pack_expansion): Likewise. From-SVN: r174201
2011-05-24re PR c++/49042 ([C++0x] wrong "protected" when using template and decltype)Jason Merrill1-4/+3
PR c++/49042 * pt.c (get_mostly_instantiated_function_type): Use push_deferring_access_checks rather than set flag_access_control. From-SVN: r174151
2011-05-24re PR c++/48884 (decltype's operand doesn't consider friend declaration)Jason Merrill1-3/+32
PR c++/48884 * class.c (pushclass): Accept NULL argument. (popclass): Deal with popping null class. * pt.c (push_access_scope, pop_access_scope): Use them rather than push_to_top_level/pop_from_top_level. (push_deduction_access_scope, pop_defarg_context): New. (fn_type_unification): Use them. * name-lookup.c (lookup_name_real_1): Check current_class_type. From-SVN: r174139
2011-05-23* pt.c (tsubst_copy_and_build): Use current_class_name.Jason Merrill1-2/+1
From-SVN: r174102
2011-05-23re PR c++/47544 ([C++0x] linker does not find =default constructor for ↵Jason Merrill1-1/+4
explicitly instantiated template) PR c++/47544 * pt.c (instantiate_decl): Handle =default. From-SVN: r174071
2011-05-23re PR c++/48617 ([C++0x] Problem with non-type template parameters and decltype)Jason Merrill1-0/+2
PR c++/48617 * pt.c (invalid_nontype_parm_type_p): Allow DECLTYPE_TYPE. From-SVN: r174070