www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24482] New: recursive alias out of order fails to compile

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

          Issue ID: 24482
           Summary: recursive alias out of order fails to compile with a
                    misleading error message
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: scrubereal gmail.com

`issue.d`:
  struct Array(E) {}
  struct Enum(T...) {T t;}
  alias NodeArray = Array!Node;
  struct Object {NodeArray values;}
  alias Node = Enum!(Object);

  void main() {}

`dmd issue.d` fails and gives the following messages.
  issue.d(3): Error: template instance `Array!Node` recursive template
expansion
  issue.d(5): Error: template instance `issue.Enum!(Object)` error
instantiating

Moving `NodeArray` below `Object` or `Node` suppresses the issue.

--
Apr 04