[Issue 22356] New: Can't mixin the return type of a function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 4 14:57:34 UTC 2021


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 at puremagic.com
          Reporter: snarwin+bugzilla at 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

--


More information about the Digitalmars-d-bugs mailing list