logoalt Hacker News

lbhdc04/24/20251 replyview on HN

Good catch. Its weird that it compiles without error as a consteval func.


Replies

TuxSH04/25/2025

Hmm, looking at cppreference:

The consteval specifier declares a function or function template to be an immediate function, that is, every potentially-evaluated call to the function must (directly or indirectly) produce a compile time constant expression.

It's possible that the compiler just doesn't bother as long as you aren't actually calling the function.