From: Jason Merrill Date: Sat, 17 Jun 2017 02:28:06 +0000 (-0400) Subject: PR c++/80614 - Wrong mangling for C++17 noexcept type X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc14602e32f0ba0b6b7628c487bfa1441c2d78f4;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2d47d7b4a7f..66dd0442700 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2017-06-16 Jason Merrill + 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 e866675bed9..c83aef5ede4 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 00000000000..8c763a536a2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type16.C @@ -0,0 +1,11 @@ +// PR c++/80614 +// { dg-options -std=c++1z } + +template void fn() {} + +int main() { + // { dg-final { scan-assembler "_Z2fnIKFvvEEvv" } } + fn(); + // { dg-final { scan-assembler "_Z2fnIKDoFvvEEvv" } } + fn(); +}