Document number: P3842R1
Audience: LWG


Ville Voutilainen
2026-03-25

A conservative fix for constexpr uncaught_exceptions() and current_exception()

Abstract

The papers P3818 and P3820 explain the background of the problem we have making uncaught_exceptions() and current_exception(). In short, having those function constexpr is a breaking change in some cases.

Due to timing and lateness thereof, it's deemed prudent to just roll back adding constexpr to those functions, and figure out a solution in C++29 for allowing those functionalities in constant expression evaluation. That was the outcome of an LEWG discussion in a September 2025 teleconference.

Wording

In [exception.syn], remove the constexpr decl-specifiers from these functions:

constexpr int uncaught_exceptions() noexcept; using exception_ptr = unspecified ; constexpr exception_ptr current_exception() noexcept;

Before [uncaught.exceptions]/1, remove the constexpr decl-specifier:

constexpr int uncaught_exceptions() noexcept;

Before [propagation]/9, remove the constexpr decl-specifier:

constexpr exception_ptr current_exception() noexcept;

In [propagation]/12, edit as follows:

Effects: Creates an exception_ptr object that refers to a copy of e, as if: try { throw e; } catch(...) { return current_exception(); } Returns: An exception_ptr object that refers to a copy of e.

Strike the note In [propagation]/13:

[Note 5: This function is provided for convenience and efficiency reasons. — end note]