From: Marek Polacek Date: Fri, 29 Mar 2019 18:40:31 +0000 (+0000) Subject: PR c++/89876 - ICE with deprecated conversion. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c072398e0f99551edb513735ef7c648f90a68eb6;p=gcc.git 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. From-SVN: r270021 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index eb35f9ec798..75d8169dae2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2019-03-29 Marek Polacek + + PR c++/89876 - ICE with deprecated conversion. + * call.c (convert_like_real): Only give warnings with tf_warning. + 2019-03-28 Marek Polacek PR c++/89612 - ICE with member friend template with noexcept. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index bc5179416a5..519dad9bf2c 100644 --- a/gcc/cp/call.c +++ b/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 a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0d954bfe2bb..960a86508b0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ PR c++/89871 * g++.dg/cpp2a/desig14.C: New test. + PR c++/89876 - ICE with deprecated conversion. + * g++.dg/warn/conv5.C: New test. + 2019-03-29 Martin Liska * gcc.dg/ipa/ipa-icf-39.c: Prine '***dbgcnt' output. diff --git a/gcc/testsuite/g++.dg/warn/conv5.C b/gcc/testsuite/g++.dg/warn/conv5.C new file mode 100644 index 00000000000..e238f9f30b7 --- /dev/null +++ b/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 +T f (T, char*); + +template +decltype (f (T (), "")) g (T) { return ""; } // { dg-error "invalid conversion" } + +void h () { g (0); }