[Issue 6524] New: Ternary operator fails to recognise implicitly	convertible function pointers
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Thu Aug 18 01:33:12 PDT 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 at puremagic.com
        ReportedBy: bugzilla at kyllingen.net
--- Comment #0 from Lars T. Kyllingstad <bugzilla at 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: -------
    
    
More information about the Digitalmars-d-bugs
mailing list