Date: Thu, 19 Feb 2026 16:24:12 +0100
Hi Jan,
On 2026-02-19T16:11:54+0100, Jan Schultke via Std-Proposals wrote:
> 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.
Some correction: this has false positives, in the sense that when
compiling with too-low optimization level you'll get unnecessary errors.
But it has absolutely no false negatives. You'll never get a successful
compilation if the compiler can't prove that a condition is true.
Have a lovely day!
Alex
On 2026-02-19T16:11:54+0100, Jan Schultke via Std-Proposals wrote:
> 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.
Some correction: this has false positives, in the sense that when
compiling with too-low optimization level you'll get unnecessary errors.
But it has absolutely no false negatives. You'll never get a successful
compilation if the compiler can't prove that a condition is true.
Have a lovely day!
Alex
-- <https://www.alejandro-colomar.es>
Received on 2026-02-19 15:24:17
