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

--- Comment #4 from Kenji Hara <[email protected]> ---

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

--

Reply via email to