From: Jason Merrill <jason@redhat.com>
To: gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: C++ PATCH for c++/80614, wrong mangling for C++17 noexcept type
Date: Fri, 16 Jun 2017 21:55:00 -0000 [thread overview]
Message-ID: <CADzB+2nyvgTn8kYR-MMxXa9WZx2F5qZ-UUHka6h1wXYoiby-Tw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 174 bytes --]
My earlier patch for noexcept types preserved the noexcept in
canonicalize_for_substitution, but lost it in write_type.
Tested x86_64-pc-linux-gnu, applying to trunk and 7.
[-- Attachment #2: 80614.diff --]
[-- Type: text/plain, Size: 1343 bytes --]
commit 152635968e18ec06da5308102c4859523c897707
Author: Jason Merrill <jason@redhat.com>
Date: Fri Jun 16 14:23:54 2017 -0400
PR c++/80614 - Wrong mangling for C++17 noexcept type
* mangle.c (write_type): Put the eh spec back on the function type.
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index e866675..c83aef5 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -2100,6 +2100,11 @@ write_type (tree type)
|| TREE_CODE (t) == METHOD_TYPE)
{
t = build_ref_qualified_type (t, type_memfn_rqual (type));
+ if (flag_noexcept_type)
+ {
+ tree r = TYPE_RAISES_EXCEPTIONS (type);
+ t = build_exception_variant (t, r);
+ }
if (abi_version_at_least (8)
|| type == TYPE_MAIN_VARIANT (type))
/* Avoid adding the unqualified function type as a substitution. */
diff --git a/gcc/testsuite/g++.dg/cpp1z/noexcept-type16.C b/gcc/testsuite/g++.dg/cpp1z/noexcept-type16.C
new file mode 100644
index 0000000..8c763a5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type16.C
@@ -0,0 +1,11 @@
+// PR c++/80614
+// { dg-options -std=c++1z }
+
+template <typename T> void fn() {}
+
+int main() {
+ // { dg-final { scan-assembler "_Z2fnIKFvvEEvv" } }
+ fn<void() const>();
+ // { dg-final { scan-assembler "_Z2fnIKDoFvvEEvv" } }
+ fn<void() const noexcept>();
+}
reply other threads:[~2017-06-16 21:55 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=CADzB+2nyvgTn8kYR-MMxXa9WZx2F5qZ-UUHka6h1wXYoiby-Tw@mail.gmail.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).