[libcxx-commits] [PATCH] D130283: [libc++] Allow assigning std::rethrow_if_nested() to a function pointer
Xing Xue via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 25 08:58:18 PDT 2022
xingxue added a comment.
> Did I overlook something and is `std::rethrow_if_nested` marked as addressable?
Hi @mordante, Thanks for your comments. I searched the standards and could not find any thing that is marked as `addressable`. I can be wrong but my reasoning is that `rethrow_if_nested()` is a global function that has a physical implementation and a physical address. Therefore, it is addressable. The following code snippet and 'nm' output show it has a physical address, noting that the signature of `rethrow_if_nested()` has `__enable_if` etc. as an argument and that is the reason why it does not match the signature defined by the standard, i.e., `void rethrow_if_nested(const E&)`, when assigned to a function pointer. `throw_with_nested()` used to have the same problem but was fixed. This patch takes the same approach as used for `throw_with_nested()`.
$ cat t.cpp:
#include <exception>
int main(int, char**)
{
int i=5;
std::rethrow_if_nested(i);
return 0;
}
$ nm t.o
0000000000000000 T main
U .TOC.
0000000000000000 W _ZSt17rethrow_if_nestedB6v15000IiEvRKT_PNSt3__19enable_ifIXntsr18__can_dynamic_castIS0_St16nested_exceptionEE5valueEvE4typeE
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130283/new/
https://reviews.llvm.org/D130283
More information about the libcxx-commits
mailing list