PR c++/87513 - 'sorry' mangling PMF template-id.
authorJason Merrill <jason@redhat.com>
Wed, 20 Feb 2019 18:59:18 +0000 (13:59 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 20 Feb 2019 18:59:18 +0000 (13:59 -0500)
Here build_offset_ref calls build_qualified_name to make a SCOPE_REF because
the dependent template arguments make type_dependent_expression_p (member)
true.  We could probably work hard to prevent this, but it doesn't seem
necessary, and it's easy to fix write_expression to handle the result.

* mangle.c (write_expression): Handle SCOPE_REF to BASELINK.

From-SVN: r269048

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

index 02e0845f1d7ceeb0c9a8f373e8745dd917022bb9..dc0d4a2081441c6df635fefde6fba13e649a4301 100644 (file)
@@ -1,3 +1,8 @@
+2019-02-19  Jason Merrill  <jason@redhat.com>
+
+       PR c++/87513 - 'sorry' mangling PMF template-id.
+       * mangle.c (write_expression): Handle SCOPE_REF to BASELINK.
+
 2019-02-19  Jason Merrill  <jason@redhat.com>
 
        PR c++/88380 - wrong-code with flexible array and NSDMI.
index f550b7550dbe554dc8d131be4a63f097b5fba99d..777c4775bfd4b921cfa46bc10c96f2f86cfde7fb 100644 (file)
@@ -3003,7 +3003,8 @@ write_expression (tree expr)
        {
          scope = TREE_OPERAND (expr, 0);
          member = TREE_OPERAND (expr, 1);
-         gcc_assert (!BASELINK_P (member));
+         if (BASELINK_P (member))
+           member = BASELINK_FUNCTIONS (member);
        }
       else
        {
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-tid1.C b/gcc/testsuite/g++.dg/cpp0x/decltype-tid1.C
new file mode 100644 (file)
index 0000000..0328502
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/87513
+// { dg-do compile { target c++11 } }
+
+struct A { template <long> void foo (); };
+template <long t> auto bar () -> decltype (&A::foo<t>);
+void foo ()
+{
+  bar<0> ();
+}