Thread overview
[Issue 18386] mixin ... isn't a template error when used in new scope
Feb 07, 2018
tetyys@tetyys.com
May 30, 2022
Nick Treleaven
May 30, 2022
Nick Treleaven
Jun 02, 2022
Nick Treleaven
Dec 17, 2022
Iain Buclaw
February 07, 2018
https://issues.dlang.org/show_bug.cgi?id=18386

tetyys@tetyys.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal

--
May 30, 2022
https://issues.dlang.org/show_bug.cgi?id=18386

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #1 from Nick Treleaven <nick@geany.org> ---
Is a function allowed to return an `enum string`? Shouldn't you use one of these:

string b(alias d)() {
    return `writeln("a");`;
}

enum string b(alias d) = `writeln("a");`;

I think this should be marked `accepts-invalid`.

--
May 30, 2022
https://issues.dlang.org/show_bug.cgi?id=18386

--- Comment #2 from Nick Treleaven <nick@geany.org> ---
Also you should use a string mixin, `mixin(b!a);` - not a template mixin.

--
June 02, 2022
https://issues.dlang.org/show_bug.cgi?id=18386

--- Comment #3 from Nick Treleaven <nick@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.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=18386

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

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

--- Comment #4 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19382

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--