www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21886] New: case where member function used as "alias this


          Issue ID: 21886
           Summary: case where member function used as "alias this sym" is
                    allowed without right `this` context
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: accepts-invalid
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

This code compiles and runs.

struct D
    static int a;

struct C
    int h;
    D get()
    alias get this;

void main(string[] args)
    if (C.a){}

get() is not executed but in first place that should not compile as in C.a
there's not valid this context.

May 01 2021