www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14161] New: UFCS call does not abide by scope

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 puremagic.com
          Reporter: alphaglosined 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
--
Feb 09 2015