[Issue 10416] New: Wrong error messages for inherited @safe class method

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 19 10:46:42 PDT 2013


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

           Summary: Wrong error messages for inherited @safe class method
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-06-19 10:46:41 PDT ---
import std.stdio: writeln;
abstract class Foo {
    void spam() @safe;
}
class Bar : Foo {
    override void spam() {
        writeln;
    }
}
void main() {}



DMD 2.063.2 gives the error message:

temp.d(7): Error: safe function 'bug2.Bar.spam' cannot call system function
'std.stdio.writeln!().writeln'

Even assuming that it's correct to label writeln() as a system function,
Bar.foo is not labeled @safe. So I think the correct error message is similar
to (note the use of system and @safe words below):


test.d(6): Error: system function bug2.Bar.spam does not override any function,
did you mean to override @safe function 'bug2.Foo.spam'?

-- 
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