[Issue 14363] New: DMD should compile SDC test0165.d

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Mar 28 09:57:30 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14363

          Issue ID: 14363
           Summary: DMD should compile SDC test0165.d
           Product: D
           Version: unspecified
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: shammah.chancellor at gmail.com

```
> rdmd test0165.d
test0165.d(22): Error: class test0165.voldemort.basilisk.GinnyWeasley is nested
within basilisk, but super class MarvoloRiddle is nested within voldemort
```


```test0165.d
//T compiles:yes
//T has-passed:yes
//T retval:41
// voldemort class with inheritance and 2 different contexts.

auto voldemort() {
    uint a = 7;

    class MarvoloRiddle {
        uint b;

        this(uint b) {
            this.b = b + a++;
        }

        auto foo() {
            return a + b;
        }
    }

    auto basilisk(uint c) {
        class GinnyWeasley : MarvoloRiddle {
            this(uint b) {
                a += c++;
                this.b = b + a++;
            }

            auto bar() {
                return foo() + a + c;
            }
        }

        return new GinnyWeasley(5);
    }

    return basilisk(3);
}

auto buzz(V)(V v) {
    return v.bar();
}

int main() {
    auto v = voldemort();
    return buzz(v);
}

```

--


More information about the Digitalmars-d-bugs mailing list