Thread overview
[Issue 10616] New: class C: C.D{static class D{}} does not work
Jul 11, 2013
timon.gehr@gmx.ch
Jul 18, 2013
Andrej Mitrovic
Jul 18, 2013
timon.gehr@gmx.ch
Jul 18, 2013
Andrej Mitrovic
Aug 05, 2013
Kenji Hara
Aug 05, 2013
Kenji Hara
Aug 05, 2013
Andrej Mitrovic
July 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10616

           Summary: class C: C.D{static class D{}} does not work
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: timon.gehr@gmx.ch


--- Comment #0 from timon.gehr@gmx.ch 2013-07-11 16:22:03 PDT ---
Crashes DMD 2.063, is an error with DMD from git head:

class C: C.D{static class D{}}

The code should compile.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10616


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-07-18 06:42:00 PDT ---
That's a borderline enhancement request. It might potentially break code too, e.g. this currently works:

-----
class D
{
}

class C : D
{
    static class D
    {
    }
}
-----

With the enhancement this would have to become a conflict, although the workaround would be easy: one could use 'class C : .D' (dot expression) for the global class and 'class C : D' for the nested one. But I'm not fond of such lookup rules where something in an inner scope ends up conflicting with an expression in an outer scope.

Well I don't think I've ever tried to use either of these samples so I don't have a strong opinion either way.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10616



--- Comment #2 from timon.gehr@gmx.ch 2013-07-18 10:53:27 PDT ---
(In reply to comment #1)
> That's a borderline enhancement request.

No, it is a bug report. C.D is a perfectly fine base class.

> It might potentially break code too,
> e.g. this currently works:
> 
> -----
> class D
> {
> }
> 
> class C : D
> {
>     static class D
>     {
>     }
> }
> -----
> 
> With the enhancement this would have to become a conflict,

I am not arguing for any enhancement that would change the meaning of the above code.

> although the
> workaround would be easy: one could use 'class C : .D' (dot expression) for the
> global class and 'class C : D' for the nested one. But I'm not fond of such
> lookup rules where something in an inner scope ends up conflicting with an
> expression in an outer scope.
> ...

I generally like shadowing, but it would indeed be utterly pointless to look up a classes' parents inside its own scope.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10616



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-07-18 13:14:30 PDT ---
(In reply to comment #2)
> I am not arguing for any enhancement that would change the meaning of the above code.

Ah, so you want this to work:

class C: C.D{static class D{}}

but this to fail:

class C: D{static class D{}}

And the following would stay as-is:

class D { } class C: D{static class D{}}  // inherits global D

If that's so then this is reasonable.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 05, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10616


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |js.mdnq@gmail.com


--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2013-08-05 01:39:06 PDT ---
*** Issue 10759 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 05, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10616


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice, pull


--- Comment #5 from Kenji Hara <k.hara.pg@gmail.com> 2013-08-05 03:21:00 PDT ---
Fix for ICE: https://github.com/D-Programming-Language/dmd/pull/2449

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 05, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10616



--- Comment #6 from github-bugzilla@puremagic.com 2013-08-05 05:14:14 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/55d944d9e06c3dc7d00a61adcdefbc0048a2e283 fix Issue 10616 - class C: C.D{static class D{}} does not work

https://github.com/D-Programming-Language/dmd/commit/1ec9aa41bf33cf1f92fc6f60bbe5244e2898a7b7 Merge pull request #2449 from 9rnsr/fix10616

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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 05, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10616


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice, pull                   |rejects-valid


--- Comment #7 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-08-05 06:53:52 PDT ---
ICE fixed, but the bug report will remain open for the rejects-valid code.

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