@ctfeonly

Jonathan M Davis newsgroup.d at jmdavisprog.com
Thu Dec 7 04:45:15 UTC 2017


On Thursday, December 07, 2017 03:59:09 Mike Franklin via Digitalmars-d 
wrote:
> Also, I want the
> compiler to let me know if my intended-for-compile-time-only
> function cannot be used at compile-time because I mistakenly made
> it dependent on something that is only available at runtime.

The simplest way to do that is to write a unit test that uses a static
assertion. As I understand it, with the way CTFE works, it pretty much can't
know whether a function can be called at compile time until it tries, but a
unit test can catch it if the function no longer works at compile time.

- Jonathan M Davis



More information about the Digitalmars-d mailing list