Don <> changed:

           What    |Removed                     |Added
           Keywords|                            |patch
            Version|2.035                       |1.00
            Summary|Program behaves differently |super behaves differently
                   |with -inline                |with -inline

--- Comment #3 from Don <> 2010-02-03 00:19:21 PST ---
The thing that isn't working correctly is this line from the 'Expressions' page
in the spec: "If a member function is called with an explicit reference to
super, a non-virtual call is made." This bug applies to D1 as well (DMD1.00

Cause: direct calls are normally implemented in e2ir.c. If CallExp::toElem()
finds TOKsuper, it makes it a non-virtual call. But the direct call is a little
bit of a hack (there's a "//BUG: fix" comment in FuncExp::toElem()).

inline.c, SuperExp::doInline() changes it from 'super' to a variable, so e2ir
can't find it.
This patch disables inlining for direct 'super' calls. Allowing them to be
inlined would be a quite difficult, I think.

Index: inline.c
--- inline.c    (revision 362)
+++ inline.c    (working copy)
@@ -275,6 +275,10 @@

 int CallExp::inlineCost(InlineCostState *ics)
+    // Bugzilla 3500: super.func() calls must be devirtualized, and the
+    // can't handle that at present.
+    if (e1->op == TOKdotvar && ((DotVarExp *)e1)->e1->op == TOKsuper)
+    return COST_MAX;
     return 1 + e1->inlineCost(ics) + arrayInlineCost(ics, arguments);

Test case without any imports: 
class A {
    void x() {  }

class B : A {
    override void x() {
    final void do_x() {

void main() {
    B b = new B();

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to