commit 152635968e18ec06da5308102c4859523c897707 Author: Jason Merrill 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 void fn() {} + +int main() { + // { dg-final { scan-assembler "_Z2fnIKFvvEEvv" } } + fn(); + // { dg-final { scan-assembler "_Z2fnIKDoFvvEEvv" } } + fn(); +}