C++ Logo

std-proposals

Advanced search

Re: [std-proposals] compile_assert() a static assert that fires at compile time, not runtime.

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Thu, 19 Feb 2026 16:32:29 +0200
On Thu, 19 Feb 2026 at 16:28, Jonathan Grant <jg_at_[hidden]> wrote:

> > 3) when the condition cannot be proven either way, the linking fails
>
> Do you have an example you're thinking of?
>
> If the condition cannot be proven met (1) the compilation fails. There would be no object file, so the linker would not start. There may be nuances, if you share an example I can take a look.

Never mind, my bad, I should've looked at the docs of the attribute:

"If the error or warning attribute is used on a function declaration
and a call to such a function is not eliminated through dead code
elimination or other optimizations, an error or warning (respectively)
that includes message is diagnosed. T"

So
3) when the condition cannot be proven either way, the compilation fails

Thank you. I'll provide further thoughts in a separate message.

Received on 2026-02-19 14:32:43