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

Walter Bright <bugzi...@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzi...@digitalmars.com
         Resolution|---                         |INVALID

--- Comment #1 from Walter Bright <bugzi...@digitalmars.com> ---
The trouble is this:

    uint g() { return 5; }
    ...
    uint delegate() d = &g;

Your proposal would cause that to fail. Inference is done for template 'a'
because the assignment is part of the expression. But for the 'g' case, there
may be intervening code of this sort:

    uint g() { return 5; }
    uint function() c = &g;
    uint delegate() d = &g;

'g' cannot be both a function and a delegate. So the simple rule is 'static'
being there or not sets it to be a function pointer or a delegate. This is
consistent with other uses of 'static'.

This is working as designed. Not a bug.

--

Reply via email to