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
I forgot to report this long time ago. This simple code didn't work. mixin("int") x; The error only happens at declaration level, it works with statements.
@BorisCarvajal created dlang/dmd pull request #13126 "Fix Issue 22356 - Can't mixin the return type of a function" fixing this issue: - Fix Issue 22356 - Can't mixin the return type of a function https://github.com/dlang/dmd/pull/13126
dlang/dmd pull request #13126 "Fix Issue 22356 - Can't mixin the return type of a function" was merged into master: - b433c28b7cd9ef4a548faf356aee16407a69775a by Boris Carvajal: Fix Issue 22356 - Can't mixin the return type of a function https://github.com/dlang/dmd/pull/13126