Document number: P3842R0
Audience: LEWG, LWG


Ville Voutilainen
2025-09-14

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;