August 18, 2011
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


--- Comment #0 from Lars T. Kyllingstad <bugzilla@kyllingen.net> 2011-08-18 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: -------
August 18, 2011
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


--- Comment #1 from yebblies <yebblies@gmail.com> 2011-08-19 01:50:27 EST ---
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: -------