www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5421] New: Ref function pointers can only be made with auto

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5421

           Summary: Ref function pointers can only be made with auto
           Product: D
           Version: D2
          Platform: All
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: eatingstaples gmail.com


--- Comment #0 from eatingstaples gmail.com 2011-01-07 06:49:31 PST ---
Creating a function pointer to a ref function can only be done using auto, but
by no explicit means. Also, aliasing a ref function pointer to another type
can't be done.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 07 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5421


Steven Schveighoffer <schveiguy yahoo.com> changed:

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


--- Comment #1 from Steven Schveighoffer <schveiguy 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: -------
Jan 07 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5421


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |DUPLICATE


--- Comment #2 from yebblies <yebblies gmail.com> 2011-06-06 19:46:53 PDT ---
*** This issue has been marked as a duplicate of issue 2753 ***

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