[Issue 13204] recursive alias declaration

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 28 07:02:25 PDT 2014


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #4 from Kenji Hara <k.hara.pg at gmail.com> ---
I think this is fixable issue.

(In reply to Jonathan M Davis from comment #1)
> Okay. Think this through. When you declare
> 
> alias A1 = ABase!1; // L6

In this first timing, ABase!1 is not yet instantiated, so its eponymous member
is yet unknown. But,

> it now has to instantiate ABase with 1. When it does that it has to define
> 
> alias whatever = Foo;
> 
> Foo is then an alias to A1, which is an alias to ABase!1. So, to determine
> what Foo is, it has to instantiate ABase!1, which it's already in the middle
> of doing.

In this second timing, compiler can recognize an aliasing from ABase!1 to the
instantiated struct type ABase!1.ABase, because the eponymous template member
can be lexically known, even though the semantic analysis of ABase!1 is not yet
completed. So compiler can make the alias A1 to the struct ABase!1.ABase.

--


More information about the Digitalmars-d-bugs mailing list