www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18386] New: mixin ... isn't a template error when used in new

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

          Issue ID: 18386
           Summary: mixin ... isn't a template error when used in new
                    scope
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: tetyys tetyys.com

Compilation of this code:

import std.stdio;

void main() { }

class c {
        this() {
                enum string b(alias d)() {
                        return `writeln("a");`;
                }

                int a;

                {
                        mixin b!a;
                        mixin b!a;
                }
        }
}

fails with dmd v2.078.1 and error

test.d(11): Error: mixin b!a b isn't a template

However, code:


import std.stdio;

void main() { }

class c {
        this() {
                enum string b(alias d)() {
                        return `writeln("a");`;
                }

                int a;

                //{
                        mixin b!a;
                        mixin b!a;
                //}
        }
}

compiles successfully

--
Feb 06 2018