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 0c3819593103a5dd014e5ee226e714096ed87b6d..2dfc8080be8802e099154435bfdf57ef4b5c906f 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 6ae5df76b1caa01a9943d62079165848ee95c216..889852f362b7a532a743ca960e5ec25fd7d9b8ca 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 615d3aeab2a96f3004bf1865768331a64cf540af..19daeff4a440232695c2ae44ab94d1f73f8c711d 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);
+}