Contract error string generation is not implicitly @nogc

Ali Çehreli acehreli at yahoo.com
Mon Sep 12 09:19:34 UTC 2022


On 9/4/22 07:06, Ali Çehreli wrote:
 > void foo(string s) @safe pure nothrow @nogc
 > in (s != "hello", "Invalid " ~ s) {
 > }
 >
 > void main() {}
 >
 > Error: cannot use operator `~` in `@nogc` function `deneme.foo`

I have an experimental solution that can throw Error objects from @nogc 
code:

   https://code.dlang.org/packages/alid%3Aerrornogc

Documentation:

   https://alid.dpldocs.info/v0.1.1/alid.errornogc.NogcError.html

Ali



More information about the Digitalmars-d mailing list