[Issue 4528] New: Better error message for private abstract method

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 28 15:20:53 PDT 2010


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

           Summary: Better error message for private abstract method
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-07-28 15:20:52 PDT ---
With this wrong program:


abstract class Foo {
    final abstract void bar();
}
void main() {}


dmd 2.047 generates the error message:
test.d(2): Error: function test.Foo.bar cannot be both final and abstract


With this other wrong program:

abstract class Foo { 
    private abstract void bar();
}
void main() {}


dmd generates the error message:
prog.d(2): Error: function test.Foo.bar non-virtual functions cannot be
abstract


But I think this second error message can be improved, because at first look
bar() looks virtual:

test.d(2): Error: member function test.Foo.bar() cannot be both private and
abstract.

Or (inspired by C# compiler):

test.d(2): Error: member function test.Foo.bar(): abstract functions cannot be
private.

Or (inspired by Java compiler):

test.d(2): Error: method test.Foo.bar(): illegal combination of modifiers:
abstract and private.

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