From 4d7f99c7453e2caf75533c1b18afdf3d7b931ebe Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 23 May 2011 11:32:39 -0400 Subject: [PATCH] re PR libstdc++/49058 ([C++0x] Bind no-arguments functor failed using std::bind with -pedantic option.) PR c++/49058 * call.c (splice_viable): Be strict in templates. From-SVN: r174073 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/call.c | 5 +++++ gcc/testsuite/ChangeLog | 2 ++ gcc/testsuite/g++.dg/cpp0x/sfinae24.C | 29 +++++++++++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae24.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4b0b3a12946..cfb6b58065c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-05-23 Jason Merrill + PR c++/49058 + * call.c (splice_viable): Be strict in templates. + PR c++/47336 * error.c (dump_template_bindings): Suppress access control. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 972dca376ee..8503f5ebabf 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3009,6 +3009,11 @@ splice_viable (struct z_candidate *cands, struct z_candidate **last_viable; struct z_candidate **cand; + /* Be strict inside templates, since build_over_call won't actually + do the conversions to get pedwarns. */ + if (processing_template_decl) + strict_p = true; + viable = NULL; last_viable = &viable; *any_viable_p = false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ac13fe55c3d..c41c7f60753 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-05-23 Jason Merrill + * g++.dg/cpp0x/sfinae24.C: New. + * g++.dg/cpp0x/error3.C: New. * g++.dg/cpp0x/defaulted27.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae24.C b/gcc/testsuite/g++.dg/cpp0x/sfinae24.C new file mode 100644 index 00000000000..3e1d2e725b0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae24.C @@ -0,0 +1,29 @@ +// PR c++/49058 +// This error is not subject to SFINAE because it doesn't happen in the +// deduction context. +// { dg-options -std=c++0x } +// { dg-prune-output "note" } + +template T val(); + +struct F1 +{ + void operator()(); +}; + +template +struct Bind +{ + template()( ) )> + R f(); + + template()( ) )> + R f() const; // { dg-error "no match" } +}; + +int main() +{ + Bind b; +} -- 2.30.2