www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19585] New: Invalid recursive template expansion error


          Issue ID: 19585
           Summary: Invalid recursive template expansion error
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ben.schaaf gmail.com

Versions: 2.081.1, 2.083.0 (What I had installed)

The following code produces a compiler error when it shouldn't:

struct A {
    M2 stdin;

mixin template Handle(T, T invalid_value = T.init) {}

struct M1 { mixin Handle!(size_t); }
struct M2 { mixin Handle!(M1); }

template `foo.Handle(T, T invalid_value = T.init)` recursive template expansion

Not using the struct doesn't produce an error, so clearly expanding M2 works
perfectly. Using M1.init instead of relying on the default parameter doesn't
produce this issue.

Jan 15