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

--- Comment #0 from Lars T. Kyllingstad <> 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:
------- You are receiving this mail because: -------

Reply via email to