re PR c++/45329 (When printing a list of candidate functions, explain why 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
This commit is contained in:
parent
c6f4a801a6
commit
3d2f686422
58 changed files with 872 additions and 277 deletions
|
@ -1,3 +1,60 @@
|
|||
2011-07-16 Nathan Froyd <froydnj@codesourcery.com>
|
||||
Jason Merrill <jason@redhat.com>
|
||||
|
||||
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.
|
||||
|
||||
2011-07-15 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* Make-lang.in (check-g++-strict-gc): New.
|
||||
|
|
144
gcc/cp/call.c
144
gcc/cp/call.c
|
@ -434,7 +434,10 @@ enum rejection_reason_code {
|
|||
rr_arity,
|
||||
rr_explicit_conversion,
|
||||
rr_arg_conversion,
|
||||
rr_bad_arg_conversion
|
||||
rr_bad_arg_conversion,
|
||||
rr_template_unification,
|
||||
rr_template_instantiation,
|
||||
rr_invalid_copy
|
||||
};
|
||||
|
||||
struct conversion_info {
|
||||
|
@ -462,6 +465,24 @@ struct rejection_reason {
|
|||
struct conversion_info conversion;
|
||||
/* Same, but for bad argument conversions. */
|
||||
struct conversion_info bad_conversion;
|
||||
/* Information about template unification failures. These are the
|
||||
parameters passed to fn_type_unification. */
|
||||
struct {
|
||||
tree tmpl;
|
||||
tree explicit_targs;
|
||||
tree targs;
|
||||
const tree *args;
|
||||
unsigned int nargs;
|
||||
tree return_type;
|
||||
unification_kind_t strict;
|
||||
int flags;
|
||||
} template_unification;
|
||||
/* Information about template instantiation failures. These are the
|
||||
parameters passed to instantiate_template. */
|
||||
struct {
|
||||
tree tmpl;
|
||||
tree targs;
|
||||
} template_instantiation;
|
||||
} u;
|
||||
};
|
||||
|
||||
|
@ -622,6 +643,50 @@ explicit_conversion_rejection (tree from, tree to)
|
|||
return r;
|
||||
}
|
||||
|
||||
static struct rejection_reason *
|
||||
template_unification_rejection (tree tmpl, tree explicit_targs, tree targs,
|
||||
const tree *args, unsigned int nargs,
|
||||
tree return_type, unification_kind_t strict,
|
||||
int flags)
|
||||
{
|
||||
size_t args_n_bytes = sizeof (*args) * nargs;
|
||||
tree *args1 = (tree *) conversion_obstack_alloc (args_n_bytes);
|
||||
struct rejection_reason *r = alloc_rejection (rr_template_unification);
|
||||
r->u.template_unification.tmpl = tmpl;
|
||||
r->u.template_unification.explicit_targs = explicit_targs;
|
||||
r->u.template_unification.targs = targs;
|
||||
/* Copy args to our own storage. */
|
||||
memcpy (args1, args, args_n_bytes);
|
||||
r->u.template_unification.args = args1;
|
||||
r->u.template_unification.nargs = nargs;
|
||||
r->u.template_unification.return_type = return_type;
|
||||
r->u.template_unification.strict = strict;
|
||||
r->u.template_unification.flags = flags;
|
||||
return r;
|
||||
}
|
||||
|
||||
static struct rejection_reason *
|
||||
template_unification_error_rejection (void)
|
||||
{
|
||||
return alloc_rejection (rr_template_unification);
|
||||
}
|
||||
|
||||
static struct rejection_reason *
|
||||
template_instantiation_rejection (tree tmpl, tree targs)
|
||||
{
|
||||
struct rejection_reason *r = alloc_rejection (rr_template_instantiation);
|
||||
r->u.template_instantiation.tmpl = tmpl;
|
||||
r->u.template_instantiation.targs = targs;
|
||||
return r;
|
||||
}
|
||||
|
||||
static struct rejection_reason *
|
||||
invalid_copy_with_fn_template_rejection (void)
|
||||
{
|
||||
struct rejection_reason *r = alloc_rejection (rr_invalid_copy);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Dynamically allocate a conversion. */
|
||||
|
||||
static conversion *
|
||||
|
@ -2859,6 +2924,7 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
|
|||
int i;
|
||||
tree fn;
|
||||
struct rejection_reason *reason = NULL;
|
||||
int errs;
|
||||
|
||||
/* We don't do deduction on the in-charge parameter, the VTT
|
||||
parameter or 'this'. */
|
||||
|
@ -2901,17 +2967,31 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
|
|||
}
|
||||
gcc_assert (ia == nargs_without_in_chrg);
|
||||
|
||||
errs = errorcount+sorrycount;
|
||||
i = fn_type_unification (tmpl, explicit_targs, targs,
|
||||
args_without_in_chrg,
|
||||
nargs_without_in_chrg,
|
||||
return_type, strict, flags);
|
||||
return_type, strict, flags, false);
|
||||
|
||||
if (i != 0)
|
||||
goto fail;
|
||||
{
|
||||
/* Don't repeat unification later if it already resulted in errors. */
|
||||
if (errorcount+sorrycount == errs)
|
||||
reason = template_unification_rejection (tmpl, explicit_targs,
|
||||
targs, args_without_in_chrg,
|
||||
nargs_without_in_chrg,
|
||||
return_type, strict, flags);
|
||||
else
|
||||
reason = template_unification_error_rejection ();
|
||||
goto fail;
|
||||
}
|
||||
|
||||
fn = instantiate_template (tmpl, targs, tf_none);
|
||||
if (fn == error_mark_node)
|
||||
goto fail;
|
||||
{
|
||||
reason = template_instantiation_rejection (tmpl, targs);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* In [class.copy]:
|
||||
|
||||
|
@ -2940,7 +3020,10 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
|
|||
tree arg_types = FUNCTION_FIRST_USER_PARMTYPE (fn);
|
||||
if (arg_types && same_type_p (TYPE_MAIN_VARIANT (TREE_VALUE (arg_types)),
|
||||
ctype))
|
||||
goto fail;
|
||||
{
|
||||
reason = invalid_copy_with_fn_template_rejection ();
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
if (obj != NULL_TREE)
|
||||
|
@ -3108,6 +3191,18 @@ print_conversion_rejection (location_t loc, struct conversion_info *info)
|
|||
info->n_arg+1, info->from_type, info->to_type);
|
||||
}
|
||||
|
||||
/* Print information about a candidate with WANT parameters and we found
|
||||
HAVE. */
|
||||
|
||||
static void
|
||||
print_arity_information (location_t loc, unsigned int have, unsigned int want)
|
||||
{
|
||||
inform_n (loc, want,
|
||||
" candidate expects %d argument, %d provided",
|
||||
" candidate expects %d arguments, %d provided",
|
||||
want, have);
|
||||
}
|
||||
|
||||
/* Print information about one overload candidate CANDIDATE. MSGSTR
|
||||
is the text to print before the candidate itself.
|
||||
|
||||
|
@ -3154,10 +3249,8 @@ print_z_candidate (const char *msgstr, struct z_candidate *candidate)
|
|||
switch (r->code)
|
||||
{
|
||||
case rr_arity:
|
||||
inform_n (loc, r->u.arity.expected,
|
||||
" candidate expects %d argument, %d provided",
|
||||
" candidate expects %d arguments, %d provided",
|
||||
r->u.arity.expected, r->u.arity.actual);
|
||||
print_arity_information (loc, r->u.arity.actual,
|
||||
r->u.arity.expected);
|
||||
break;
|
||||
case rr_arg_conversion:
|
||||
print_conversion_rejection (loc, &r->u.conversion);
|
||||
|
@ -3171,6 +3264,39 @@ print_z_candidate (const char *msgstr, struct z_candidate *candidate)
|
|||
"conversion", r->u.conversion.from_type,
|
||||
r->u.conversion.to_type);
|
||||
break;
|
||||
case rr_template_unification:
|
||||
/* We use template_unification_error_rejection if unification caused
|
||||
actual non-SFINAE errors, in which case we don't need to repeat
|
||||
them here. */
|
||||
if (r->u.template_unification.tmpl == NULL_TREE)
|
||||
{
|
||||
inform (loc, " substitution of deduced template arguments "
|
||||
"resulted in errors seen above");
|
||||
break;
|
||||
}
|
||||
/* Re-run template unification with diagnostics. */
|
||||
inform (loc, " template argument deduction/substitution failed:");
|
||||
fn_type_unification (r->u.template_unification.tmpl,
|
||||
r->u.template_unification.explicit_targs,
|
||||
r->u.template_unification.targs,
|
||||
r->u.template_unification.args,
|
||||
r->u.template_unification.nargs,
|
||||
r->u.template_unification.return_type,
|
||||
r->u.template_unification.strict,
|
||||
r->u.template_unification.flags,
|
||||
true);
|
||||
break;
|
||||
case rr_template_instantiation:
|
||||
/* Re-run template instantiation with diagnostics. */
|
||||
instantiate_template (r->u.template_instantiation.tmpl,
|
||||
r->u.template_instantiation.targs,
|
||||
tf_warning_or_error);
|
||||
break;
|
||||
case rr_invalid_copy:
|
||||
inform (loc,
|
||||
" a constructor taking a single argument of its own "
|
||||
"class type is invalid");
|
||||
break;
|
||||
case rr_none:
|
||||
default:
|
||||
/* This candidate didn't have any issues or we failed to
|
||||
|
|
|
@ -6570,7 +6570,7 @@ resolve_address_of_overloaded_function (tree target_type,
|
|||
targs = make_tree_vec (DECL_NTPARMS (fn));
|
||||
if (fn_type_unification (fn, explicit_targs, targs, args, nargs,
|
||||
target_ret_type, DEDUCE_EXACT,
|
||||
LOOKUP_NORMAL))
|
||||
LOOKUP_NORMAL, false))
|
||||
/* Argument deduction failed. */
|
||||
continue;
|
||||
|
||||
|
|
|
@ -5161,7 +5161,8 @@ extern tree instantiate_class_template (tree);
|
|||
extern tree instantiate_template (tree, tree, tsubst_flags_t);
|
||||
extern int fn_type_unification (tree, tree, tree,
|
||||
const tree *, unsigned int,
|
||||
tree, unification_kind_t, int);
|
||||
tree, unification_kind_t, int,
|
||||
bool);
|
||||
extern void mark_decl_instantiated (tree, int);
|
||||
extern int more_specialized_fn (tree, tree, int);
|
||||
extern void do_decl_instantiation (tree, tree);
|
||||
|
|
683
gcc/cp/pt.c
683
gcc/cp/pt.c
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,61 @@
|
|||
2011-07-16 Nathan Froyd <froydnj@codesourcery.com>
|
||||
Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/45329
|
||||
PR c++/48934
|
||||
* g++.dg/cpp0x/decltype29.C: Adjust.
|
||||
* g++.dg/cpp0x/error4.C: Adjust.
|
||||
* g++.dg/cpp0x/sfinae26.C: Adjust.
|
||||
* g++.dg/cpp0x/variadic105.C: Adjust.
|
||||
* g++.dg/template/deduce3.C: Adjust.
|
||||
* g++.dg/template/error45.C: Adjust.
|
||||
* g++.dg/template/ptrmem2.C: Adjust.
|
||||
* g++.dg/template/sfinae2.C: Adjust.
|
||||
* g++.old-deja/g++.pt/crash60.C: Adjust.
|
||||
* g++.old-deja/g++.pt/unify6.C: Adjust.
|
||||
* g++.dg/cpp0x/lambda/lambda-ice2.C: Adjust.
|
||||
* g++.dg/cpp0x/nullptr15.C: Adjust.
|
||||
* g++.dg/cpp0x/pr31431-2.C: Adjust.
|
||||
* g++.dg/cpp0x/pr31431.C: Adjust.
|
||||
* g++.dg/cpp0x/pr31434.C: Adjust.
|
||||
* g++.dg/cpp0x/sfinae11.C: Adjust
|
||||
* g++.dg/cpp0x/temp_default2.C: Adjust.
|
||||
* g++.dg/cpp0x/trailing4.C: Adjust.
|
||||
* g++.dg/cpp0x/variadic-ex3.C: Adjust.
|
||||
* g++.dg/cpp0x/variadic-ex4.C: Adjust.
|
||||
* g++.dg/cpp0x/variadic105.C: Adjust.
|
||||
* g++.dg/cpp0x/vt-37737-2.C: Adjust.
|
||||
* g++.dg/ext/vla2.C: Adjust.
|
||||
* g++.dg/other/ptrmem10.C: Adjust.
|
||||
* g++.dg/other/ptrmem11.C: Adjust.
|
||||
* g++.dg/overload/unknown1.C: Adjust.
|
||||
* g++.dg/template/conv11.C: Adjust.
|
||||
* g++.dg/template/dependent-expr5.C: Adjust.
|
||||
* g++.dg/template/friend.C: Adjust.
|
||||
* g++.dg/template/incomplete2.C: Adjust.
|
||||
* g++.dg/template/local4.C: Adjust.
|
||||
* g++.dg/template/local6.C: Adjust.
|
||||
* g++.dg/template/operator9.C: Adjust.
|
||||
* g++.dg/template/ttp25.C: Adjust.
|
||||
* g++.dg/template/unify10.C: Adjust.
|
||||
* g++.dg/template/unify11.C: Adjust.
|
||||
* g++.dg/template/unify6.C: Adjust.
|
||||
* g++.dg/template/unify9.C: Adjust.
|
||||
* g++.dg/template/varmod1.C: Adjust.
|
||||
* g++.old-deja/g++.brendan/crash56.C: Adjust.
|
||||
* g++.old-deja/g++.pt/crash28.C: Adjust.
|
||||
* g++.old-deja/g++.pt/explicit41.C: Adjust.
|
||||
* g++.old-deja/g++.pt/explicit77.C: Adjust.
|
||||
* g++.old-deja/g++.pt/expr2.C: Adjust.
|
||||
* g++.old-deja/g++.pt/ptrmem6.C: Adjust.
|
||||
* g++.old-deja/g++.pt/spec5.C: Adjust.
|
||||
* g++.old-deja/g++.pt/spec6.C: Adjust.
|
||||
* g++.old-deja/g++.pt/unify4.C: Adjust.
|
||||
* g++.old-deja/g++.pt/unify8.C: Adjust.
|
||||
* g++.old-deja/g++.robertl/eb98.C: Adjust.
|
||||
* g++.dg/overload/template5.C: New testcase.
|
||||
* g++.dg/template/overload12.C: New testcase.
|
||||
|
||||
2011-07-11 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
* gfortran.dg/coarray_14.f90: Remove dg-error "sorry not implemented".
|
||||
|
|
|
@ -13,7 +13,7 @@ decltype (ft<F> (F()))
|
|||
ft() {} // { dg-error "depth" }
|
||||
|
||||
int main() {
|
||||
ft<struct a*, 0>(); // { dg-error "no match" }
|
||||
ft<struct a*, 0>(); // { dg-error "no match|wrong number" }
|
||||
}
|
||||
|
||||
// { dg-prune-output "note" }
|
||||
|
|
|
@ -10,7 +10,7 @@ struct S {
|
|||
static U get(const volatile T&);
|
||||
|
||||
template<typename U>
|
||||
static decltype(*declval<U>()) get(...);
|
||||
static decltype(*declval<U>()) get(...); // { dg-error "operator*" }
|
||||
|
||||
typedef decltype(get<T>(declval<T>())) type; // { dg-error "no match" }
|
||||
};
|
||||
|
|
|
@ -9,8 +9,9 @@ decltype(F()) run(F f) // { dg-message "note" }
|
|||
|
||||
int main()
|
||||
{
|
||||
auto l = []() { return 5; };
|
||||
auto l = []() { return 5; }; // { dg-error "lambda closure type" }
|
||||
|
||||
run(l); // { dg-error "no match" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 14 }
|
||||
// { dg-error "use of deleted function" "candidate explanation" { target *-*-* } 5 }
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@ void test_g()
|
|||
// Deduction to nullptr_t, no deduction to pointer type
|
||||
//
|
||||
g(nullptr); // { dg-error "no matching function for call to " }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 19 }
|
||||
// { dg-message "(candidate|mismatched types)" "candidate note" { target *-*-* } 19 }
|
||||
type_equal<float*>(g((float*)nullptr));
|
||||
decltype(nullptr) mynull = 0;
|
||||
g(mynull); // { dg-error "no matching function for call to " }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 23 }
|
||||
// { dg-message "(candidate|mismatched types)" "candidate note" { target *-*-* } 23 }
|
||||
type_equal<float*>(g((float*)mynull));
|
||||
}
|
||||
|
|
|
@ -4,5 +4,5 @@ template<typename, typename..., typename> void foo(); // { dg-message "note" }
|
|||
void bar()
|
||||
{
|
||||
foo<int>(); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 6 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 6 }
|
||||
}
|
||||
|
|
|
@ -4,5 +4,5 @@ template<typename..., typename> void foo(); // { dg-message "note" }
|
|||
void bar()
|
||||
{
|
||||
foo<int>(); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 6 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 6 }
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ template<typename... T> int foo(const T&) // { dg-error "not expanded with|T" }
|
|||
void bar()
|
||||
{
|
||||
foo(0); // { dg-error "no matching" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 10 }
|
||||
// { dg-message "(candidate|cannot convert)" "candidate note" { target *-*-* } 10 }
|
||||
}
|
||||
|
|
|
@ -51,6 +51,6 @@ int main()
|
|||
// static_assert( noexcept( f3(y) ), "shall be ill-formed(OK)." );
|
||||
|
||||
noexcept( f1(z) ); // { dg-message "required" }
|
||||
static_assert( noexcept( f2(z) ), "shall be ill-formed." ); // { dg-error "no match" }
|
||||
static_assert( noexcept( f2(z) ), "shall be ill-formed." ); // { dg-error "no match|could not convert" }
|
||||
noexcept( f3(z) ); // { dg-message "required" }
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ struct S {
|
|||
template<class... U,
|
||||
typename enable_if<and_<is_same<T, U>...>::value>::type*& = enabler
|
||||
>
|
||||
S(U...){} // #
|
||||
S(U...){} // { dg-error "no type named 'type'" }
|
||||
};
|
||||
|
||||
S<bool> s(0); // { dg-error "no match" }
|
||||
|
|
|
@ -8,7 +8,7 @@ void g()
|
|||
f(1, 'c'); // f<int,char>(1,'c')
|
||||
f(1); // f<int,double>(1,0)
|
||||
f(); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 10 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 10 }
|
||||
f<int>(); // f<int,double>(0,0)
|
||||
f<int,char>(); // f<int,char>(0,0)
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ auto f(T,U) -> decltype(T() + U())
|
|||
template<class T> void g(T){} // { dg-message "note" }
|
||||
|
||||
int main() { g(f); } // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 10 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 10 }
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ void g()
|
|||
{
|
||||
int i = f<int>(5.6);
|
||||
int j = f(5.6); // { dg-error "no matching" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 6 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 6 }
|
||||
f<void>(f<int, bool>);
|
||||
f<void>(f<int>); // { dg-error "no matching" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 9 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 9 }
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@ void g()
|
|||
f<int>("aa",3.0); // Y is deduced to be char*, and
|
||||
// Z is deduced to be double
|
||||
f("aa",3.0); // { dg-error "no matching" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 10 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 10 }
|
||||
f2<char, short, int, long>(); // okay
|
||||
}
|
||||
|
|
|
@ -21,4 +21,5 @@ struct call_sum {
|
|||
int main() {
|
||||
// This shouldn't be an error; this is bug 35722.
|
||||
reverse<call_sum>(1,2); // { dg-bogus "no match" "" { xfail *-*-* } }
|
||||
// { dg-bogus "sorry, unimplemented" "candidate explanation" { xfail *-*-* } 6 }
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ template<class U, class... T>
|
|||
void f() // { dg-message "note" }
|
||||
{
|
||||
f<T...>(); // { dg-error "no matching" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 6 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 6 }
|
||||
}
|
||||
|
||||
template<>
|
||||
|
|
|
@ -15,5 +15,5 @@ void bar(int i)
|
|||
char d[i] ;
|
||||
|
||||
begin(d); // { dg-error "no matching function" "" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 17 }
|
||||
// { dg-message "(candidate|valid template argument)" "candidate note" { target *-*-* } 17 }
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ template <class C>
|
|||
static void
|
||||
bar(C *c, void (C::*m) ())
|
||||
{
|
||||
foo<C,m>((void *)c);// { dg-error "(not a valid template arg|pointer-to-member|no matching fun)" }
|
||||
foo<C,m>((void *)c);// { dg-error "(not a valid template arg|pointer-to-member|no matching fun|could not convert)" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 16 }
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ template <typename T>
|
|||
int
|
||||
bar(int T::* p)
|
||||
{
|
||||
return foo<p>(0);// { dg-error "(not a valid template arg|no matching func|pointer-to-member)" }
|
||||
return foo<p>(0);// { dg-error "(not a valid template arg|no matching func|pointer-to-member|could not convert)" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 17 }
|
||||
}
|
||||
|
||||
|
|
15
gcc/testsuite/g++.dg/overload/template5.C
Normal file
15
gcc/testsuite/g++.dg/overload/template5.C
Normal file
|
@ -0,0 +1,15 @@
|
|||
// { dg-do compile }
|
||||
|
||||
template<typename T>
|
||||
int low(T a, T b, T c) { return a + b + c; } // { dg-message "template" }
|
||||
|
||||
template<typename T>
|
||||
int high(T a, T b, T c) { return a + b + c; } // { dg-message "template" }
|
||||
|
||||
int test (void)
|
||||
{
|
||||
low (5, 6); // { dg-error "no matching function" }
|
||||
// { dg-message "(candidate|3 arguments, 2 provided)" "" { target *-*-* } 11 }
|
||||
high (5, 6, 7, 8); // { dg-error "no matching function" }
|
||||
// { dg-message "(candidate|3 arguments, 4 provided)" "" { target *-*-* } 13 }
|
||||
}
|
|
@ -6,5 +6,5 @@ template <typename T> void bar(T f); // { dg-message "note" }
|
|||
|
||||
void baz() {
|
||||
bar(foo); // { dg-error "<unresolved overloaded function type>" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 8 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 8 }
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@ struct A
|
|||
int main()
|
||||
{
|
||||
A().operator int(); // { dg-error "operator int" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 9 }
|
||||
// { dg-message "(candidate|mismatched types)" "candidate note" { target *-*-* } 9 }
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ void f(int, T (*)() = 0); // { dg-message "note" }
|
|||
void g() {
|
||||
typedef int A[2];
|
||||
f<A>(0); // { dg-error "" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 6 }
|
||||
// { dg-error "returning an array" "candidate explanation" { target *-*-* } 2 }
|
||||
typedef void F();
|
||||
f<F>(0); // { dg-error "" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 9 }
|
||||
// { dg-error "returning a function" "candidate explanation" { target *-*-* } 2 }
|
||||
}
|
||||
|
|
|
@ -40,12 +40,12 @@ struct foo {
|
|||
bind (&bar::baikt);
|
||||
|
||||
bind (&barf); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 42 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 42 }
|
||||
bind (&foo::barf); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 44 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 44 }
|
||||
|
||||
bindm (&barf); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 47 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 47 }
|
||||
bindm (&foo::barf);
|
||||
|
||||
bindn (&barf);
|
||||
|
@ -53,15 +53,15 @@ struct foo {
|
|||
|
||||
bindb (&barf);
|
||||
bindb (&foo::barf); // { dg-error "ambiguous" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 55 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 55 }
|
||||
|
||||
bind (&bark); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 58 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 58 }
|
||||
bind (&bar::bark); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 60 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 60 }
|
||||
|
||||
bindm (&bark); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 63 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 63 }
|
||||
bindm (&bar::bark);
|
||||
|
||||
bindn (&bark);
|
||||
|
@ -69,7 +69,7 @@ struct foo {
|
|||
|
||||
bindb (&bark);
|
||||
bindb (&bar::bark); // { dg-error "ambiguous" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 71 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 71 }
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -92,12 +92,12 @@ struct foo {
|
|||
bind (&barT::baikt);
|
||||
|
||||
bind (&barf); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 94 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 94 }
|
||||
bind (&foo::barf); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 96 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 96 }
|
||||
|
||||
bindm (&barf); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 99 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 99 }
|
||||
bindm (&foo::barf);
|
||||
|
||||
bindn (&barf);
|
||||
|
@ -105,15 +105,15 @@ struct foo {
|
|||
|
||||
bindb (&barf);
|
||||
bindb (&foo::barf); // { dg-error "ambiguous" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 107 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 107 }
|
||||
|
||||
bind (&bark); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 110 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 110 }
|
||||
bind (&barT::bark); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 112 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 112 }
|
||||
|
||||
bindm (&bark); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 115 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 115 }
|
||||
bindm (&barT::bark);
|
||||
|
||||
bindn (&bark);
|
||||
|
@ -121,7 +121,7 @@ struct foo {
|
|||
|
||||
bindb (&bark);
|
||||
bindb (&barT::bark); // { dg-error "ambiguous" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 123 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 123 }
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ struct enable_if< true, T >
|
|||
|
||||
template < typename T >
|
||||
struct enable_if< true, T >::type
|
||||
f( T x );
|
||||
f( T x ); // { dg-error "not a class type" }
|
||||
|
||||
void
|
||||
g( void )
|
||||
|
|
|
@ -26,5 +26,5 @@ int main()
|
|||
{
|
||||
s<int>::t y;
|
||||
cout << y; // { dg-error "" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 28 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 28 }
|
||||
}
|
||||
|
|
|
@ -9,6 +9,6 @@ A a; // { dg-error "incomplete type" }
|
|||
|
||||
void bar()
|
||||
{
|
||||
foo<a>(); // { dg-error "no matching function" }
|
||||
foo<a>(); // { dg-error "(no matching function|could not convert)" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 12 }
|
||||
}
|
||||
|
|
|
@ -5,6 +5,6 @@ template <typename T> void foo() {} // { dg-message "note" }
|
|||
|
||||
int main () {
|
||||
struct S {};
|
||||
foo<S> (); // { dg-error "match" }
|
||||
foo<S> (); // { dg-error "(match|template argument for|trying to instantiate)" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 8 }
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ template <class T> struct PCVector2 // { dg-message "note" }
|
|||
PCVector2<T> operator- (const PCVector2<T> &ov) const
|
||||
{
|
||||
return PCVector2<T>(ov.xFIELD, ov.yFIELD); // { dg-error "matching" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 7 }
|
||||
// { dg-message "(candidate|expects 1 argument, 2 provided|cannot convert)" "candidate note" { target *-*-* } 7 }
|
||||
}
|
||||
|
||||
T xFIELD, yFIELD;
|
||||
|
|
|
@ -5,6 +5,6 @@ template<operator+> void foo(); // { dg-error "before|non-function|template" }
|
|||
void bar()
|
||||
{
|
||||
foo(); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 7 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 7 }
|
||||
}
|
||||
|
||||
|
|
17
gcc/testsuite/g++.dg/template/overload12.C
Normal file
17
gcc/testsuite/g++.dg/template/overload12.C
Normal file
|
@ -0,0 +1,17 @@
|
|||
// { dg-do compile }
|
||||
|
||||
struct S {int x; int y;};
|
||||
template<typename T>
|
||||
int foo(T a, T b) {return a + b;} // { dg-message "template" }
|
||||
template<typename T, typename T2>
|
||||
int foo(T a, T2& b, T2 c) {return a + b;} // { dg-message "template" }
|
||||
int foo(char*, S&); // { dg-message "foo" }
|
||||
// { dg-message "candidate expects 2 arguments, 3 provided" "arity" { target *-*-* } 8 }
|
||||
|
||||
int foo2(int x)
|
||||
{
|
||||
S s={1,2};
|
||||
char c;
|
||||
foo(c, 2, c); // { dg-error "no matching function" }
|
||||
// { dg-message "(candidate|deduced conflicting types for)" "candidate note" { target *-*-* } 15 }
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
struct A {};
|
||||
|
||||
template <typename T> T A::* Foo (); // { dg-message "note" }
|
||||
template <typename T> T A::* Foo (); // { dg-error "reference" }
|
||||
|
||||
void Baz ()
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ template<int T> struct cl {
|
|||
const static int value = T;
|
||||
};
|
||||
|
||||
template<int I> void fn (char (*) [cl<I>::value] = 0 ); // { dg-message "note" }
|
||||
template<int I> void fn (char (*) [cl<I>::value] = 0 ); // { dg-error "zero-size array" }
|
||||
|
||||
void foo (void)
|
||||
{
|
||||
|
|
|
@ -18,12 +18,12 @@ void f4(T, C<5>); // { dg-message "note" }
|
|||
template<int N> struct X {};
|
||||
void g() {
|
||||
f1(5l, X<5>()); // { dg-error "no matching" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 20 }
|
||||
// { dg-message "(candidate|inconsistent with)" "candidate note" { target *-*-* } 20 }
|
||||
f2(X<5>(), 5);
|
||||
f3(X<5>(), 5l); // { dg-error "no matching" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 23 }
|
||||
// { dg-message "(candidate|inconsistent with)" "candidate note" { target *-*-* } 23 }
|
||||
f4(5, X<5>());
|
||||
f4(5l, X<5>()); // { dg-error "no matching" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 26 }
|
||||
// { dg-message "(candidate|inconsistent with)" "candidate note" { target *-*-* } 26 }
|
||||
f4((short)5, X<5>());
|
||||
}
|
||||
|
|
|
@ -26,34 +26,34 @@ void cvFunction(void (CLASS::* method)() const volatile) {} // { dg-message "not
|
|||
int main() {
|
||||
mFunction(&MyClass::mMethod);
|
||||
mFunction(&MyClass::cMethod); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 28 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 28 }
|
||||
mFunction(&MyClass::vMethod); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 30 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 30 }
|
||||
mFunction(&MyClass::cvMethod); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 32 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 32 }
|
||||
|
||||
cFunction(&MyClass::mMethod); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 35 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 35 }
|
||||
cFunction(&MyClass::cMethod);
|
||||
cFunction(&MyClass::vMethod); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 38 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 38 }
|
||||
cFunction(&MyClass::cvMethod); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 40 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 40 }
|
||||
|
||||
vFunction(&MyClass::mMethod); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 43 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 43 }
|
||||
vFunction(&MyClass::cMethod); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 45 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 45 }
|
||||
vFunction(&MyClass::vMethod);
|
||||
vFunction(&MyClass::cvMethod); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 48 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 48 }
|
||||
|
||||
cvFunction(&MyClass::mMethod); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 51 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 51 }
|
||||
cvFunction(&MyClass::cMethod); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 53 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 53 }
|
||||
cvFunction(&MyClass::vMethod); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 55 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 55 }
|
||||
cvFunction(&MyClass::cvMethod);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -20,7 +20,7 @@ struct B
|
|||
C (U t)
|
||||
{
|
||||
A a;
|
||||
A b = foo (this, a, t); // { dg-error "no matching function" }
|
||||
A b = foo (this, a, t); // { dg-error "(no matching function|is not a)" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 23 }
|
||||
}
|
||||
} c;
|
||||
|
|
|
@ -19,5 +19,5 @@ void Bar ()
|
|||
Foo3 (&Baz);
|
||||
|
||||
Foo3 (&Baz, &Baz); // { dg-error "no matching function" "" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 21 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 21 }
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ int main()
|
|||
{
|
||||
Foo (f);
|
||||
Baz (f); // { dg-error "no matching function" "" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 13 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 13 }
|
||||
}
|
||||
|
|
|
@ -14,5 +14,5 @@ const X *x;
|
|||
|
||||
int main () {
|
||||
f (*x, &X::g); // { dg-error "no matching function" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 16 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 16 }
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@ void bar()
|
|||
int i;
|
||||
int A[i][i];
|
||||
foo(A); // { dg-error "" }
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 9 }
|
||||
// { dg-message "(candidate|not a valid template argument)" "candidate note" { target *-*-* } 9 }
|
||||
}
|
||||
|
|
|
@ -278,7 +278,7 @@ SetLD<T>::remove(const T& item)
|
|||
Vix x;
|
||||
for (first(x); 0 != x && this->REMOVE_CURRENT != a; next(x, a))
|
||||
a = operator()(x) == item ? this->REMOVE_CURRENT: this->NORMAL; // { dg-error "" } .*
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 280 }
|
||||
// { dg-message "(candidate|not derived from)" "candidate note" { target *-*-* } 280 }
|
||||
}
|
||||
template<class T>
|
||||
bool
|
||||
|
@ -287,7 +287,7 @@ SetLD<T>::contains(const T& item) const
|
|||
Vix x;
|
||||
for (first(x); 0 != x; next(x)) {
|
||||
if (operator()(x) == item)// { dg-error "" } .*
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 289 }
|
||||
// { dg-message "(candidate|not derived from)" "candidate note" { target *-*-* } 289 }
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
|
@ -11,5 +11,5 @@ void f(unsigned int n) {
|
|||
int x[n];
|
||||
|
||||
asize(x); // { dg-error "" } no matching function
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 13 }
|
||||
// { dg-message "(candidate|not a valid template argument)" "candidate note" { target *-*-* } 13 }
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
template< typename SID, class SDR >
|
||||
void k( SID sid, SDR* p,
|
||||
void (SDR::*)
|
||||
( typename SID::T ) ); // { dg-message "note" }
|
||||
( typename SID::T ) ); // { dg-error "no type named 'T'" }
|
||||
|
||||
struct E { };
|
||||
struct S { void f( int ); };
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// { dg-do assemble }
|
||||
template <int I>
|
||||
void f(int i); // { dg-message "note" }
|
||||
void f(int i); // { dg-message "void f" }
|
||||
|
||||
void g()
|
||||
{
|
||||
|
|
|
@ -15,5 +15,5 @@ void g() {
|
|||
|
||||
f<0>(s0, s2);
|
||||
f(s0, s2); // { dg-error "" } no matching function
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 17 }
|
||||
// { dg-message "(candidate|deduced conflicting types|ambiguous base class)" "candidate note" { target *-*-* } 17 }
|
||||
}
|
||||
|
|
|
@ -9,5 +9,5 @@ void foo(S<J + 2>); // { dg-message "note" }
|
|||
void bar()
|
||||
{
|
||||
foo(S<3>()); // { dg-error "" } no way to deduce J from this.
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 11 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 11 }
|
||||
}
|
||||
|
|
|
@ -13,9 +13,9 @@ public:
|
|||
};
|
||||
|
||||
template <void (A::*)() >
|
||||
void g() {} // { dg-message "note" }
|
||||
void g() {} // { dg-message "void g" }
|
||||
template <int A::*>
|
||||
void h() {} // { dg-message "note" }
|
||||
void h() {} // { dg-message "void h" }
|
||||
|
||||
|
||||
int main() {
|
||||
|
|
|
@ -14,9 +14,9 @@ template void g(int i, int j);
|
|||
void h()
|
||||
{
|
||||
f(3, 'c'); // { dg-error "" } no matching function
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 16 }
|
||||
// { dg-message "(candidate|deduced conflicting types)" "candidate note" { target *-*-* } 16 }
|
||||
g(3, 'c'); // { dg-error "" } no matching function
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 18 }
|
||||
// { dg-message "(candidate|deduced conflicting types)" "candidate note" { target *-*-* } 18 }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@ void h()
|
|||
{
|
||||
S1 s1;
|
||||
s1.f(3, 'c'); // { dg-error "" } no matching function
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 27 }
|
||||
// { dg-message "(candidate|deduced conflicting types)" "candidate note" { target *-*-* } 27 }
|
||||
|
||||
S2<char> s2;
|
||||
s2.f(3, 'c'); // { dg-error "" } no matching function
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 31 }
|
||||
// { dg-message "(candidate|deduced conflicting types)" "candidate note" { target *-*-* } 31 }
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@ int
|
|||
main ()
|
||||
{
|
||||
f (g); // { dg-error "" } ambiguous unification
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 10 }
|
||||
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 10 }
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ template<> void fn<int &>() {} // ok, specialize A
|
|||
template<> void fn<void ()>() {} // ok, specialize A
|
||||
|
||||
// now make sure we moan when we really should
|
||||
template<class T> void foo(T const *){} // { dg-message "note" }
|
||||
template<class T> void foo(T const *){} // { dg-error "pointer to reference" }
|
||||
|
||||
void f()
|
||||
{
|
||||
|
|
|
@ -16,6 +16,6 @@ void Foo (float); // { dg-message "note" } candidate
|
|||
void baz (int **p1)
|
||||
{
|
||||
Foo (p1); // { dg-error "match" } no such function
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 18 }
|
||||
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 18 }
|
||||
Bar (p1); // OK
|
||||
}
|
||||
|
|
|
@ -15,5 +15,5 @@
|
|||
void f()
|
||||
{
|
||||
extent(b); // { dg-error "" } no matching function
|
||||
// { dg-message "candidate" "candidate note" { target *-*-* } 17 }
|
||||
// { dg-message "(candidate|mismatched types)" "candidate note" { target *-*-* } 17 }
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue