We just need to handle the exception specification like other properties of a function typedef.
Tested x86_64-pc-linux-gnu, applying to trunk/9. PR c++/90731 * decl.c (grokdeclarator): Propagate eh spec from typedef. --- gcc/cp/decl.c | 1 + gcc/testsuite/g++.dg/cpp1z/noexcept-type22.C | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/noexcept-type22.C diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e55de5dd53d..6ad558eef9e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12848,6 +12848,7 @@ grokdeclarator (const cp_declarator *declarator, memfn_quals |= type_memfn_quals (type); rqual = type_memfn_rqual (type); type_quals = TYPE_UNQUALIFIED; + raises = TYPE_RAISES_EXCEPTIONS (type); } } diff --git a/gcc/testsuite/g++.dg/cpp1z/noexcept-type22.C b/gcc/testsuite/g++.dg/cpp1z/noexcept-type22.C new file mode 100644 index 00000000000..dd9924ff1b1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type22.C @@ -0,0 +1,6 @@ +// PR c++/90731 +// { dg-do compile { target c++17 } } + +typedef void T() noexcept(true); +T t; +void t() noexcept(true); base-commit: a5ed4958a2c1b563e933b25ca3b481761cc40b07 -- 2.18.1