C++: Fix ICE in fold_for_warn on CAST_EXPR (PR c++/83974)
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 23 Jan 2018 21:19:09 +0000 (21:19 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Tue, 23 Jan 2018 21:19:09 +0000 (21:19 +0000)
gcc/cp/ChangeLog:
PR c++/83974
* pt.c (tsubst_copy_and_build) <CONSTRUCTOR>: 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
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/pr83974.C [new file with mode: 0644]

index a0a3c13d993591dcd27554a2a521f6f04b63c103..1f26155ddf1217b37ad990a8bc1ce13c24426a8b 100644 (file)
@@ -1,3 +1,9 @@
+2018-01-23  David Malcolm  <dmalcolm@redhat.com>
+
+       PR c++/83974
+       * pt.c (tsubst_copy_and_build) <CONSTRUCTOR>: Remove early bailout
+       for pointer to member function types.
+
 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
 
        PR sanitizer/83987
index 695870da32cd0a55e189e45dc48edbf4e1f95fb2..fe64b0647b042c089519cbb2da37dc62ffef5bfd 100644 (file)
@@ -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.  */
index ce9c3c8e10bd4c6c2f1c607d589127cb47ae2901..fb7e457175747a2bb6fcdd99773857a93ffe19f0 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-23  David Malcolm  <dmalcolm@redhat.com>
+
+       PR c++/83974
+       * g++.dg/warn/pr83974.C: New test case.
+
 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..af12c2d
--- /dev/null
@@ -0,0 +1,11 @@
+// { dg-options "-Wtautological-compare" }
+
+struct A {
+  typedef void (A::*B) ();
+  operator B ();
+};
+template <typename>
+struct C {
+  void foo () { d == 0; }
+  A d;
+};