C++23 added the 𝒊𝒇 𝒄𝒐𝒏𝒔𝒕𝒆𝒗𝒂𝒍 statement, which can test whether the code is invoked from a constant-evaluated context.
This allows for functions that couldn't be constant-evaluated to provide alternate implementations.
Note that while similar, this is different than 𝒊𝒇 𝒄𝒐𝒏𝒔𝒕𝒆𝒙𝒑𝒓, for which the condition is always evaluated in a constant context.
Compiler Explorer link: https://compiler-explorer.com/z/j8PbdfzT3