@nogc

Manu via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 10 19:43:04 PDT 2014


Actually, as an addition, I'm also running into this:

  assert(false, "Message " ~ to!string(var));

  > "Error: 'std.conv.to!string' is not nothrow"

Just as assert() is accepted in nothrow, should it also be the case
that throwing functions used to produce an error message like this
should be accepted, or not?

On 11 July 2014 12:31, Manu <turkeyman at gmail.com> wrote:
> So, we allow assert() in nothrow functions, the argument is that
> assert is non-recoverable, so it's distinct from user exceptions.
>
> I have this in my 'nothrow @nogc' function:
>   assert(false, "Message " ~ details);
>
> It complains "Error: cannot use operator ~ in @nogc function"
>
> I think it should be allowed to invoke the GC for formatting error
> messages inside of assert statements, just the same as assert() is
> allowed inside of nothrow functions.
>
> Thoughts?


More information about the Digitalmars-d mailing list