[Issue 12979] Nothrow violation error is hidden by inline assembler
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Sep 28 19:03:50 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12979
--- Comment #4 from Kenji Hara <k.hara.pg at gmail.com> ---
Finally I thought that the following semantic would be pragmatic.
By default, inline assembler statement is handled as impure, unsafe, throwable,
and gc-able.
void f()() { asm { nop; } }
pragma(msg, typeof(&f!()));
// will print 'void function() @system'
But, explicit annotating with 'pure', 'nothrow', '@trusted', and '@nogc' will
be able to override the behavior.
void f2()() pure nothrow @trusted @nogc { asm { nop; } }
pragma(msg, typeof(&f2!()));
// will print 'void function() pure nothrow @trusted @nogc'
And still, inline assembler is unsafe, so it will conflict wiht '@safe'
attribute.
void f3()() @safe { asm { nop; } }
pragma(msg, typeof(&f3!()));
// Error: inline assembler not allowed in @safe function f!().f
--
More information about the Digitalmars-d-bugs
mailing list