diff options
author | Jason Merrill <jason@redhat.com> | 2017-06-16 22:28:06 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-06-16 22:28:06 -0400 |
commit | cc14602e32f0ba0b6b7628c487bfa1441c2d78f4 (patch) | |
tree | f9b7c64916947594eee50c02da78aab19cca9bf9 /gcc | |
parent | 3da557ec145823c3f51ff3fa7c619d0064134800 (diff) | |
download | gcc-cc14602e32f0ba0b6b7628c487bfa1441c2d78f4.zip gcc-cc14602e32f0ba0b6b7628c487bfa1441c2d78f4.tar.gz gcc-cc14602e32f0ba0b6b7628c487bfa1441c2d78f4.tar.bz2 |
PR c++/80614 - Wrong mangling for C++17 noexcept type
* mangle.c (write_type): Put the eh spec back on the function type.
From-SVN: r249321
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1z/noexcept-type16.C | 11 |
3 files changed, 19 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2d47d7b..66dd044 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2017-06-16 Jason Merrill <jason@redhat.com> + PR c++/80614 - Wrong mangling for C++17 noexcept type + * mangle.c (write_type): Put the eh spec back on the function type. + PR c++/81102 - Wrong error with partial specialization. * pt.c (unify) [TEMPLATE_PARM_INDEX]: Strip reference when comparing types. Do type deduction later. 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>(); +} |