The current csnonical way is to use an static_assert with an always_false template with the types as template parameters.

 

It is also mentioned in this paper as workaround.
 

-----Ursprüngliche Nachricht-----
Von: Pavel Vazharov via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Fr 19.05.2023 12:29
Betreff: Re: [std-proposals] std::terminate_compilation
An: std-proposals@lists.isocpp.org;
CC: Pavel Vazharov <freakpv@gmail.com>;
 
if constexpr ( .... ) { . . . }
else if constexpr ( ... ) { . . . }
else
{
    std::terminate_compilation();
}
I think this proposal covers the above case
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2593r0.html
-- 
 Std-Proposals mailing list
 Std-Proposals@lists.isocpp.org
 https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals