www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22356] New: Can't mixin the return type of a function

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

          Issue ID: 22356
           Summary: Can't mixin the return type of 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.097.2, the following program fails to compile:

---
mixin("void") func_name() { /* ... */ }
---

The error message is:

---
bug.d(1): Error: found `func_name` when expecting `;`
bug.d(1): Error: declaration expected, not `(`
---

According to the language spec, any BasicType can be used as a function return
type [1], and a MixinType can be used anywhere a BasicType is allowed [2], so
the program should compile.

[1] https://dlang.org/spec/function.html#FuncDeclaration
[2] https://dlang.org/spec/type.html#BasicType

--
Oct 04 2021