[Issue 13010] Use variable range propagation (VRP) for static assert

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jun 30 04:31:08 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13010

--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Lionello Lunesu from comment #0)
> This code should work:
> 
> void testvrp(ubyte l)
> {
>   immutable int i = l;
>   static assert(i + 1);
> }

To me the code looks very weird, because:

1. static assert condition is *always* evaluated in compile time.
2. but the expression i + 1 cannot be evaluated at compile time.

These items are contradict each other, so I think it should not be compiled.

Could you please show me an *actual* use case of this enhancement?

--


More information about the Digitalmars-d-bugs mailing list