www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21558] New: UFCS doesn't play nice with hijacked default

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

          Issue ID: 21558
           Summary: UFCS doesn't play nice with hijacked default
                    properties
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: rumbu rumbu.ro

int sizeof(int a) { return 42; }
int nameof(int a) { return 99; }

int a;
int x = sizeof(a)    //42
int y = a.sizeof()   //Error: function expected before () ...
int z = a.sizeof     //4, but dangerous, maybe the user expects 42

int xx = nameof(a)    //99
int yy = a.nameof()   //Error: function expected before () ...
int zz = a.nameof     //Error: cannot implicitly ... string to int

--
Jan 18 2021