This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-10-26
[Accepted as a DR at the June, 2023 meeting.]
Subclause 7.6.1.3 [expr.call] paragraph 6 specifies:
... The initialization and destruction of each parameter occurs within the context of the calling function. [Example 2: The access of the constructor, conversion functions or destructor is checked at the point of call in the calling function. If a constructor or destructor for a function parameter throws an exception, the search for a handler starts in the calling function; in particular, if the function called has a function-try-block (14.1 [except.pre]) with a handler that can handle the exception, this handler is not considered. —end example]
However, there is no calling function in the case where a function call appears in the initializer of a namespace-scope variable. Likewise, some constant expressions appearing in a type-id do not have calling functions, either. For example:
class C {
private:
constexpr int C(int) {}
friend void foo(int (*a)[1]) noexcept;
};
constexpr int bar(C) { return 1; }
void foo(int (&a)[bar(1)]) noexcept(bar(2) > 0); // presumably OK because of friendship
Proposed resolution (approved by CWG 2023-04-28):
Change in 7.6.1.3 [expr.call] paragraph 6 as follows:
... The initialization and destruction of each parameter occurs within the context of thecalling functionfull-expression (6.9.1 [intro.execution]) where the function call appears. [Example 2: The access (11.8.1 [class.access.general]) of the constructor, conversion functions, or destructor is checked at the point of callin the calling function. If a constructor or destructor for a function parameter throws an exception,the search for a handler starts in the calling function; in particular, if the function called has aany function-try-block (14.1 [except.pre]) of the called function with a handler that can handle the exception, this handleris not considered. —end example]