[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
Fri Jul 22 09:38:07 PDT 2022


xingxue added a comment.

In D130283#3669617 <https://reviews.llvm.org/D130283#3669617>, @Mordante wrote:

> I'm not too familiar with this code so I won't approve it. I wonder whether we want to allow taking the address of this function.

>From this document namespace.std <http://eel.is/c++draft/namespace.std#6>, it seems it is allowed to take the address of `std::rethrow_if_nested`. @ldionne, @hubert.reinterpretcast, please correct me if my interpretation is wrong.  Thanks!

  Let F denote a standard library function ([global.functions]), a standard library static member function, or an instantiation of a standard library function template.
  Unless F is designated an addressable function, the behavior of a C++ program is unspecified (possibly ill-formed) if it explicitly or implicitly attempts to form a pointer to F.
  [Note 1: Possible means of forming such pointers include application of the unary & operator ([expr.unary.op]), addressof ([specialized.addressof]), or a function-to-pointer standard conversion ([conv.func]).
  — end note]
  Moreover, the behavior of a C++ program is unspecified (possibly ill-formed) if it attempts to form a reference to F or if it attempts to form a pointer-to-member designating either a standard library non-static member function ([member.functions]) or an instantiation of a standard library member function template.


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