www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23205] New: Can't declare mixin template inside a function

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

          Issue ID: 23205
           Summary: Can't declare mixin template inside a function
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

As of DMD 2.100.0, the following program fails to compile:

---
void fun()
{
    mixin template tpl() {}
}
---

The error message is

---
bug.d(3): Error: identifier expected, not `template`
bug.d(3): Error: `;` expected after `mixin`
bug.d(3): Error: found `)` instead of statement
bug.d(4): Error: unmatched closing brace
---

--
Jun 22 2022