[Issue 17684] New: `static alias this` bug or incomplete implementation?
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Tue Jul 25 05:56:33 PDT 2017
    
    
  
https://issues.dlang.org/show_bug.cgi?id=17684
          Issue ID: 17684
           Summary: `static alias this` bug or incomplete implementation?
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: slavo5150 at yahoo.com
Consider the following code:
import std.stdio;
struct StaticStruct
{
    static int X;
    static alias X this;
}
struct InstanceStruct
{
    int X;
    alias X this;
}
void main()
{
    StaticStruct = 5;     // Exhibit A: No Error
    int V = StaticStruct; // Exhibit B: Error: type StaticStruct has no value
    InstanceStruct s;
    s = 5;
    int v = s;
}
`static alias this` does not work in the same manner as `alias this`, only with
static members.
If you believe `static alias this` is not a valid feature, then Exhibit A
should not compile.
If you believe `static alias this` is a valid feature, then Exhibit B should
compile and work.
Either way it's a bug.
--
    
    
More information about the Digitalmars-d-bugs
mailing list