aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-05-23 11:32:39 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-05-23 11:32:39 -0400
commit4d7f99c7453e2caf75533c1b18afdf3d7b931ebe (patch)
tree408da199f5363260069631ac8fcc8abf25a61d69 /gcc
parent42d1e31d0f0352009d851f52a9cfd5273ad303f8 (diff)
downloadgcc-4d7f99c7453e2caf75533c1b18afdf3d7b931ebe.zip
gcc-4d7f99c7453e2caf75533c1b18afdf3d7b931ebe.tar.gz
gcc-4d7f99c7453e2caf75533c1b18afdf3d7b931ebe.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/call.c5
-rw-r--r--gcc/testsuite/ChangeLog2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/sfinae24.C29
4 files changed, 39 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4b0b3a1..cfb6b58 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2011-05-23 Jason Merrill <jason@redhat.com>
+ 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 972dca3..8503f5e 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 ac13fe5..c41c7f6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,7 @@
2011-05-23 Jason Merrill <jason@redhat.com>
+ * 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 0000000..3e1d2e7
--- /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<typename T> T val();
+
+struct F1
+{
+ void operator()();
+};
+
+template<typename F>
+struct Bind
+{
+ template<typename R
+ = decltype( val<F>()( ) )>
+ R f();
+
+ template<typename R
+ = decltype( val<const F>()( ) )>
+ R f() const; // { dg-error "no match" }
+};
+
+int main()
+{
+ Bind<F1> b;
+}