[Issue 19103] New: Can imports symbols in module to a struct with mixin.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 20 00:11:00 UTC 2018


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

          Issue ID: 19103
           Summary: Can imports symbols in module to a struct with mixin.
           Product: D
           Version: D2
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: kntroh at gmail.com

Mixing import statements in a struct.
Then symbols in the module will be imported as a members of the struct.
This bug seems to be from dmd 2.080.0 to current nightly build.

---
void main() {
        //(new C).writeln("OK."); // Error: no property writeln for type
test.C, did you mean std.stdio.writeln(T...)(T args)?
        S1 s1;
        s1.writeln("Hey?"); // It can be compiled and runs!
        S2 s2;
        //s2.writeln("OK."); //  Error: no property writeln for type S2, did
you mean std.stdio.writeln(T...)(T args)?
}

mixin template T() {
        import std.stdio;
}

class C {
        mixin T;
}
struct S1 {
        mixin T;
}
struct S2 {
        private import std.stdio;
}

--


More information about the Digitalmars-d-bugs mailing list