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: nob...@puremagic.com
        ReportedBy: bugzi...@kyllingen.net


--- Comment #0 from Lars T. Kyllingstad <bugzi...@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: -------

Reply via email to