www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6524] New: Ternary operator fails to recognise implicitly convertible function pointers

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

           Summary: Ternary operator fails to recognise implicitly
                    convertible function pointers
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bugzilla kyllingen.net



01:33:09 PDT ---
Test case:

    int foo() { return 0; }
    int bar()  safe pure nothrow { return 1; }

    void main()
    {
        bool b;
        auto fptr = b ? &foo : &bar;
    }

Since  safe, pure and nothrow function pointers are implicitly convertible to
function pointers without these attributes, the above should compile just fine.
 Instead, dmd gives the following error:

    test.d(7): Error: incompatible types for ((& foo) ? (& bar)):
    'int function()' and 'int function() pure nothrow  safe'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 18 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6524


yebblies <yebblies gmail.com> changed:

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



The patch/pull request for this has been sitting in github for a couple of
months now.

*** This issue has been marked as a duplicate of issue 3180 ***

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