C++ Logo

std-proposals

Advanced search

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

From: Jan Schultke <janschultke_at_[hidden]>
Date: Thu, 19 Feb 2026 16:11:54 +0100
I can't bring myself not to think of it as a "false positive".
compile_assert is asking the question "Is it known at compile time that
this condition is true?"

There are cases where the answer is yes, but the compiler can't prove it,
so it explodes and gives you a false positive diagnostic.

One could say that this feature has no false positives and false negatives
when phrasing what compile_assert does in terms of compiler mechanics, but
that doesn't seem helpful. When the compiler gives you an error when it
theoretically shouldn't, and it only does so due to
insufficient cleverness, that's a false positive to me. We treat compiler
warnings as a false positive when that happens.

>

Received on 2026-02-19 15:12:08