[Issue 5421] Ref function pointers can only be made with auto

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 7 07:07:51 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5421


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com


--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-01-07 07:05:33 PST ---
Example code showing the issue:

int x;
ref int foo()
{
    return x;
}

void main()
{
    auto func = &foo;
    pragma(msg, typeof(func).stringof); // outputs "int function() ref"
    //int function() ref func; // uncomment for error
    func() = 5;
}

Error when auto is not used:

testreffuncptr.d(9): no identifier for declarator int function()
testreffuncptr.d(9): semicolon expected, not 'ref'
testreffuncptr.d(9): found 'ref' instead of statement

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list