PR c++/71495 - spurious note during SFINAE.
authorJason Merrill <jason@redhat.com>
Fri, 15 Jul 2016 18:56:29 +0000 (14:56 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 15 Jul 2016 18:56:29 +0000 (14:56 -0400)
* call.c (convert_like_real): Mask complain.
* semantics.c (perform_koenig_lookup): Likewise.

From-SVN: r238397

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/semantics.c
gcc/testsuite/g++.dg/cpp0x/sfinae57.C [new file with mode: 0644]

index 0c38195..2dfc808 100644 (file)
@@ -1,5 +1,9 @@
 2016-07-15  Jason Merrill  <jason@redhat.com>
 
+       PR c++/71495
+       * call.c (convert_like_real): Mask complain.
+       * semantics.c (perform_koenig_lookup): Likewise.
+
        PR c++/71092
        * constexpr.c (cxx_eval_call_expression): Fail quietly when cgraph
        threw away DECL_SAVED_TREE.
index 6ae5df7..889852f 100644 (file)
@@ -6640,7 +6640,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
       expr = decay_conversion (expr, complain);
       if (expr == error_mark_node)
        {
-         if (complain)
+         if (complain & tf_error)
            {
              maybe_print_user_conv_context (convs);
              if (fn)
index 615d3ae..19daeff 100644 (file)
@@ -2245,7 +2245,7 @@ perform_koenig_lookup (cp_expr fn, vec<tree, va_gc> *args,
       if (!fn)
        {
          /* The unqualified name could not be resolved.  */
-         if (complain)
+         if (complain & tf_error)
            fn = unqualified_fn_lookup_error (cp_expr (identifier, loc));
          else
            fn = identifier;
diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae57.C b/gcc/testsuite/g++.dg/cpp0x/sfinae57.C
new file mode 100644 (file)
index 0000000..975a330
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/71495
+// { dg-do compile { target c++11 } }
+
+struct A;
+template <class T> void f(T);  // { dg-bogus "initializing" }
+template <class T> T&& declval();
+struct B
+{
+  template <class T, class U> static decltype(f<T>(declval<U>())) g(int);
+  template <class T, class U> void g(...);
+} b;
+
+int main()
+{
+  b.g<A,A>(42);
+}