From 7c719d0849416861fa96317ade2e2035d6ea071b Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 23 Jan 2018 21:19:09 +0000 Subject: [PATCH] C++: Fix ICE in fold_for_warn on CAST_EXPR (PR c++/83974) gcc/cp/ChangeLog: PR c++/83974 * pt.c (tsubst_copy_and_build) : Remove early bailout for pointer to member function types. gcc/testsuite/ChangeLog: PR c++/83974 * g++.dg/warn/pr83974.C: New test case. From-SVN: r256999 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 4 ---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/warn/pr83974.C | 11 +++++++++++ 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/warn/pr83974.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a0a3c13d993..1f26155ddf1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-01-23 David Malcolm + + PR c++/83974 + * pt.c (tsubst_copy_and_build) : Remove early bailout + for pointer to member function types. + 2018-01-23 Jakub Jelinek PR sanitizer/83987 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 695870da32c..fe64b0647b0 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18097,10 +18097,6 @@ tsubst_copy_and_build (tree t, if (type == error_mark_node) RETURN (error_mark_node); - /* digest_init will do the wrong thing if we let it. */ - if (type && TYPE_PTRMEMFUNC_P (type)) - RETURN (t); - /* We do not want to process the index of aggregate initializers as they are identifier nodes which will be looked up by digest_init. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ce9c3c8e10b..fb7e4571757 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-23 David Malcolm + + PR c++/83974 + * g++.dg/warn/pr83974.C: New test case. + 2018-01-23 Jakub Jelinek PR sanitizer/83987 diff --git a/gcc/testsuite/g++.dg/warn/pr83974.C b/gcc/testsuite/g++.dg/warn/pr83974.C new file mode 100644 index 00000000000..af12c2dedca --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/pr83974.C @@ -0,0 +1,11 @@ +// { dg-options "-Wtautological-compare" } + +struct A { + typedef void (A::*B) (); + operator B (); +}; +template +struct C { + void foo () { d == 0; } + A d; +}; -- 2.30.2