Here a missing guard caused the usual "Error reporting routines re-entered."

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2019-03-29  Marek Polacek  <pola...@redhat.com>

        PR c++/89876 - ICE with deprecated conversion.
        * call.c (convert_like_real): Only give warnings with tf_warning.

        * g++.dg/warn/conv5.C: New test.

diff --git gcc/cp/call.c gcc/cp/call.c
index bc5179416a5..519dad9bf2c 100644
--- gcc/cp/call.c
+++ gcc/cp/call.c
@@ -7446,7 +7446,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, 
int argnum,
 
     case ck_qual:
       /* Warn about deprecated conversion if appropriate.  */
-      string_conv_p (totype, expr, 1);
+      if (complain & tf_warning)
+       string_conv_p (totype, expr, 1);
       break;
 
     case ck_ptr:
diff --git gcc/testsuite/g++.dg/warn/conv5.C gcc/testsuite/g++.dg/warn/conv5.C
new file mode 100644
index 00000000000..e238f9f30b7
--- /dev/null
+++ gcc/testsuite/g++.dg/warn/conv5.C
@@ -0,0 +1,11 @@
+// PR c++/89876
+// { dg-do compile { target c++11 } }
+// { dg-prune-output "sorry" }
+
+template <typename T>
+T f (T, char*);
+
+template <typename T>
+decltype (f (T (), "")) g (T) { return ""; } // { dg-error "invalid 
conversion" }
+
+void h () { g (0); }

Reply via email to