[Issue 5171] Prevent compiling of class when @disable is used on an overriding function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 9 11:11:42 PST 2010


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


Jesse Phillips <Jesse.K.Phillips+D at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |
            Summary|@disable doesn't work on    |Prevent compiling of class
                   |opEquals functions          |when @disable is used on an
                   |                            |overriding function
           Severity|normal                      |enhancement


--- Comment #4 from Jesse Phillips <Jesse.K.Phillips+D at gmail.com> 2010-11-09 11:10:36 PST ---
class A {
   void hello() {
   }
}
class B : A {
   @disable override void hello() {
   }
}

void main() {
   auto a = new A();
   A b = new B();

   b.hello();
}

The compiler should not compile the class saying something to the effect of:
Can not disable method hello in base class A from B.
Or another suggestion "Cannot @disable overriding function hello in B"

Note that I think the code below should still compile:

class A {
   @disable void hello() {
   }
}
class B : A {
   override void hello() {
   }
}

void main() {
   auto a = new A();
   B b = new B();

   b.hello();
}

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