[Issue 13589] [git-head] Asm statement could be assumed to nothrow, safe, pure by the enclosing function attribute

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Oct 8 09:17:12 PDT 2014


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

--- Comment #6 from Kenji Hara <k.hara.pg at gmail.com> ---
OK, I found a better explanation.

If an asm statement does not have attributes, its attribute will be inferred
from the *explicitly specified* attributes on enclosing function.

void f1() {
  asm {...}
  // f1 has no explicit attributes, so asm is inferred as system, impure,
throwable
}

void f2()() {
  asm {...}
  // f2 has no explicit attributes, so asm is inferred as system, impure,
throwable
}

void f3() @safe pure {
  asm {...}
  // f3 has explicit @safe attribute, so asm is inferred as @trusted, pure, but
throwable
}

void f4()() @truested nothrow {
  asm {...}
  // f4 has explicit @safe attribute, so asm is inferred as @trusted, nothrow ,
but impure
}

--


More information about the Digitalmars-d-bugs mailing list