On Sunday, 2 March 2025 at 19:31:06 UTC, realhet wrote:
Anyone have an idea?

While template mixins have access to the caller scope, the default values for parameters apparently don't. If you `inline` the default value, it will work

```
import std.traits;
mixin template T(string def)
{
enum generatedStr = FieldTypeTuple!(typeof(mixin("new class{"~def~"}"))).stringof;
}

void main()
{
        mixin T!"int a, b;" mixin1;
        pragma(msg, mixin1.generatedStr);
        struct LocalStruct{ int aaa; }
        mixin T!"LocalStruct ls;" mixin2;
        pragma(msg, mixin2.generatedStr);
}
```

Reply via email to