[Issue 10616] class C: C.D{static class D{}} does not work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 20 22:36:58 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=10616


Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |
           Severity|normal                      |enhancement


--- Comment #9 from Kenji Hara <k.hara.pg at gmail.com> 2013-11-20 22:36:52 PST ---
(In reply to comment #7)
> ICE fixed, but the bug report will remain open for the rejects-valid code.

The members of class X are unknown during the resolution of the class X
hierarchy. In other words, it's a limitation that whole class hierarchy must be
already known when class members being iterated.

This is necessary to test self type inside class member scope.

class B {
    void foo() {}
}
class C(T) : T
{
  /* if C!T inherits B, override B.foo */
  static if (is(C : B))
    override void foo() {}
}
alais CB = C!B;

To return 'true' at the static if condition, the fact "C!B inherits B" should
be already known.
For that, compiler determines whole class hierarchy before each class members
semantic.
And, it is the exact behavior that current dmd does.

---

By the current semantic strategy for classes, the OP code won't be compiled. So
this is not a rejects-valid bug.
To accept the OP code, we should drastically improve semantic analysis
mechanism.

Change the importance to 'enhancement'.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list