Hi.

The patch installed as r277614 is not exactly 1:1 to the previous
revision, but I forgot to remove hashing of FIELD_DECL. The tree type
is not handled in operand_equal_p.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

I'm going to install it as obvious.
Thanks,
Martin

gcc/ChangeLog:

2019-11-04  Martin Liska  <mli...@suse.cz>

        PR c++/92339
        * fold-const.c (operand_compare::hash_operand): Remove FIELD_DECL
        handling.

gcc/testsuite/ChangeLog:

2019-11-04  Martin Liska  <mli...@suse.cz>

        PR c++/92339
        * g++.dg/pr92339.C: New test.
---
 gcc/fold-const.c               |  4 ----
 gcc/testsuite/g++.dg/pr92339.C | 10 ++++++++++
 2 files changed, 10 insertions(+), 4 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/pr92339.C


diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 1e25859a707..88a069f4306 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -3682,10 +3682,6 @@ operand_compare::hash_operand (const_tree t, inchash::hash &hstate,
     case IDENTIFIER_NODE:
       hstate.add_object (IDENTIFIER_HASH_VALUE (t));
       return;
-    case FIELD_DECL:
-      inchash::add_expr (DECL_FIELD_OFFSET (t), hstate, flags);
-      inchash::add_expr (DECL_FIELD_BIT_OFFSET (t), hstate, flags);
-      return;
     case FUNCTION_DECL:
       /* When referring to a built-in FUNCTION_DECL, use the __builtin__ form.
 	 Otherwise nodes that compare equal according to operand_equal_p might
diff --git a/gcc/testsuite/g++.dg/pr92339.C b/gcc/testsuite/g++.dg/pr92339.C
new file mode 100644
index 00000000000..5bf15b08b17
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr92339.C
@@ -0,0 +1,10 @@
+/* PR c++/92339  */
+/* { dg-options "-std=c++11" } */
+
+class a {
+  template <typename b, b a::*> struct c { c(a *); };
+  int m_fn1();
+  unsigned long d;
+  using e = c<unsigned long, &a::d>;
+};
+int a::m_fn1() { e(this); return 0; }

Reply via email to