PR c++/81188 - matching decltype of member function call.
authorJason Merrill <jason@redhat.com>
Thu, 29 Jun 2017 19:44:12 +0000 (15:44 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 29 Jun 2017 19:44:12 +0000 (15:44 -0400)
* tree.c (cp_tree_equal): Remove COMPONENT_REF special case.

From-SVN: r249813

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/g++.dg/cpp0x/decltype-call4.C [new file with mode: 0644]

index 17da1c5868dd607e4c38620f638417fc5637db22..0fae3cd66840d344b766ecfe8618884d91dd1bc2 100644 (file)
@@ -1,3 +1,8 @@
+2017-06-29  Jason Merrill  <jason@redhat.com>
+
+       PR c++/81188 - matching decltype of member function call.
+       * tree.c (cp_tree_equal): Remove COMPONENT_REF special case.
+
 2017-06-29  Nathan Sidwell  <nathan@acm.org>
 
        PR c++/81247
index 4535af64dc6551bcab42dbf1ec07f03cf4735503..a52a9e8fa9f1a8ce4d864d7e11542cb9327dda49 100644 (file)
@@ -3589,11 +3589,6 @@ cp_tree_equal (tree t1, tree t2)
        return false;
       return cp_tree_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t1, 1));
 
-    case COMPONENT_REF:
-      if (TREE_OPERAND (t1, 1) != TREE_OPERAND (t2, 1))
-       return false;
-      return cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
-
     case PARM_DECL:
       /* For comparing uses of parameters in late-specified return types
         with an out-of-class definition of the function, but can also come
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-call4.C b/gcc/testsuite/g++.dg/cpp0x/decltype-call4.C
new file mode 100644 (file)
index 0000000..d504954
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/81188
+// { dg-do compile { target c++11 } }
+
+template <class F>
+struct C {
+  F fast(long i) const;
+  auto operator[](long i) const -> decltype(this->fast(i));
+};
+
+template <class F>
+auto C<F>::operator[](long i) const -> decltype(this->fast(i)) {
+  return fast(i);
+}