commit b064aafb08a8c85cfb84c839e21cf704adb42b2d
Author: Jason Merrill <jason@redhat.com>
Date: Sun May 22 22:18:07 2011 -0400
PR c++/49058
* call.c (splice_viable): Be strict in templates.
@@ -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;
new file mode 100644
@@ -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;
+}