This one was fixed by r259717, but that commit didn't include any tests.  So
it's reasonable to add something that exercises that code path.

Tested on x86_64-linux, applying to trunk.

2019-06-12  Marek Polacek  <pola...@redhat.com>

        PR c++/87410
        * g++.dg/cpp1y/pr87410.C: New test.

diff --git gcc/testsuite/g++.dg/cpp1y/pr87410.C 
gcc/testsuite/g++.dg/cpp1y/pr87410.C
new file mode 100644
index 00000000000..5a691e40b0a
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp1y/pr87410.C
@@ -0,0 +1,19 @@
+// PR c++/87410
+// { dg-do compile { target c++14 } }
+
+template <long a> using b = const char[a];
+template <typename, int c, int e, typename f>
+constexpr auto g(b<c> &, b<e> &, f) {}
+template <typename d, int a> auto h(b<a> &) {
+  auto i = j(static_cast<d **>(nullptr));
+  return **i;
+}
+class k {
+  using l = k;
+  const int &m() const;
+  friend constexpr auto j(l **n) -> decltype(n) {
+    g<int>("", "", static_cast<const int &(k::*)() const>(&k::m));
+    return n;
+  }
+};
+k o = h<k, 1>("");

Reply via email to