[Issue 7052] New: @system on @safe class methods inconsistency

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 2 09:56:46 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=7052

           Summary: @system on @safe class methods inconsistency
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: code at klickverbot.at


--- Comment #0 from klickverbot <code at klickverbot.at> 2011-12-02 09:55:41 PST ---
Consider:
---
void unsafe() {}
@safe class Foo {
  void bar() @system {
    unsafe();
  }
}
---

DMD 2.057 Git (887dda0ba) fails with:
---
Error: safe function 'bar' cannot call system function 'unsafe'
---


The following two examples compile, however (note the different position of
@system in the first example):
---
void unsafe() {}
@safe class Foo {
  @system void bar() {
    unsafe();
  }
}
---
---
void unsafe() {}
@safe class Foo {
  void bar() @trusted {
    unsafe();
  }
}
---


Given that the effects of @safe being applied to classes don't seem to be
mentioned in the spec, this is technically not a rejects-valid bug, but
certainly very inconsistent.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list