#include <utility> template<class T> void foo(T, typename std::enable_if<noexcept(T(std::declval<T>())), int>::type) { } int main() { foo(0,0); } Results in: Test.cpp: In instantiation of ‘void foo(T, typename std::enable_if<noexcept ((T)(declval<T>())), int>::type) [with T = int; typename std::enable_if<noexcept ((T)(declval<T>())), int>::type = int]’: Test.cpp:19:6: sorry, unimplemented: mangling noexcept_expr void foo(T, typename std::enable_if<noexcept(T(std::declval<T>())), int>::type) ^
Still present on trunk, four years later.
The relevant code seems to live in gcc/cp/mangle.c (at least for IA64 mangling) Does it just need something like the following inserted into the write_expression() function? ``` else if (TREE_CODE (expr) == NOEXCEPT_EXPR) { write_string ("nx"); write_expression (TREE_OPERAND (expr, 0)); } ``` The "nx" prefix seems to be what LLVM uses for its Itanium mangling. See https://github.com/llvm/llvm-project/blob/13a1504ffb9a9a4f82dc1b60d9e8cbb173c7d030/clang/lib/AST/ItaniumMangle.cpp#L4057 Also see example showing this under clang (working) and gcc (failing): https://godbolt.org/z/yHrZDm
... so I don't forget. but not a GCC 10 thing
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:999e617d3121b82921c8031ee695fd036f553f04 commit r14-1516-g999e617d3121b82921c8031ee695fd036f553f04 Author: Patrick Palka <ppalka@redhat.com> Date: Sat Jun 3 09:03:27 2023 -0400 c++: mangle noexcept-expr [PR70790] This implements noexcept(expr) mangling and demangling as per the Itanium ABI. PR c++/70790 gcc/cp/ChangeLog: * mangle.cc (write_expression): Handle NOEXCEPT_EXPR. libiberty/ChangeLog: * cp-demangle.c (cplus_demangle_operators): Add the noexcept operator. (d_print_comp_inner) <case DEMANGLE_COMPONENT_UNARY>: Always print parens around the operand of noexcept too. * testsuite/demangle-expected: Test noexcept operator demangling. gcc/testsuite/ChangeLog: * g++.dg/abi/mangle78.C: New test.