[Issue 18386] mixin ... isn't a template error when used in new scope

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 2 15:25:54 UTC 2022


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

--- Comment #3 from Nick Treleaven <nick at geany.org> ---
I think mixing in an eponymous template should be an error as it is confusing.
Reduced:

void main() {
    template b(alias d) {
        enum b = ``;
    }

    int a;

    {
        pragma(msg, is(typeof(b) == string)); // false
        mixin b!a;
        pragma(msg, is(typeof(b) == string)); // true
        mixin b!a; // error
    }
}

As before, if the {} scope block braces are removed, there's no error.

--


More information about the Digitalmars-d-bugs mailing list