[Issue 14161] New: UFCS call does not abide by scope

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Feb 9 19:59:13 PST 2015


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

          Issue ID: 14161
           Summary: UFCS call does not abide by scope
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: alphaglosined at gmail.com

If global function declared as same name to a local function pointer, UFCS will
call the global function.

Discovered: http://forum.dlang.org/post/qgtyvxurlgbrctjvnzlv@forum.dlang.org
> import std.stdio;
> 
> void f(int a) {
>      writeln("it's a function! : ", a);
> }
> 
> void main() {
>      auto f = function (int a) {writeln("It's a variable! : ", a);};
>      5.f();
>      f(5);
> }
> 
> Output:
> 
> it's a function! : 5
> It's a variable! : 5

--


More information about the Digitalmars-d-bugs mailing list