public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [pushed] c++: Mangling of dependent conversions [PR91377]
Date: Sat,  4 Apr 2020 16:22:36 -0400	[thread overview]
Message-ID: <20200404202236.11987-1-jason@redhat.com> (raw)

We skip over other conversion codes when mangling expressions, we should do
the same with IMPLICIT_CONV_EXPR.

Tested x86_64-pc-linux-gnu, applying to trunk/9/8.

gcc/cp/ChangeLog
2020-04-04  Jason Merrill  <jason@redhat.com>

	PR c++/91377
	* mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
---
 gcc/cp/mangle.c                     |  1 +
 gcc/testsuite/g++.dg/abi/mangle75.C | 13 +++++++++++++
 2 files changed, 14 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/abi/mangle75.C

diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 1fc78bfa753..9e39cfd8dba 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -2875,6 +2875,7 @@ write_expression (tree expr)
   /* Skip NOP_EXPR and CONVERT_EXPR.  They can occur when (say) a pointer
      argument is converted (via qualification conversions) to another type.  */
   while (CONVERT_EXPR_CODE_P (code)
+	 || code == IMPLICIT_CONV_EXPR
 	 || location_wrapper_p (expr)
 	 /* Parentheses aren't mangled.  */
 	 || code == PAREN_EXPR
diff --git a/gcc/testsuite/g++.dg/abi/mangle75.C b/gcc/testsuite/g++.dg/abi/mangle75.C
new file mode 100644
index 00000000000..f2661997a33
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle75.C
@@ -0,0 +1,13 @@
+// PR c++/91377
+// { dg-do compile { target c++11 } }
+
+struct f {
+  static constexpr int d = 3;
+  typedef int e;
+};
+template <int a> struct x { };
+template <typename g, g j, g m> using n = x<j + m>;
+template <typename ac> auto v() -> n<typename ac::e, 0, ac::d>;
+void af() { v<f>(); }
+
+// { dg-final { scan-assembler "_Z1vI1fE1xIXplLi0EsrT_1dEEv" } }

base-commit: 21e28527130a89491f848dfb5019afa01b252479
-- 
2.18.1


                 reply	other threads:[~2020-04-04 20:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200404202236.11987-1-jason@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).