[Issue 3267] New: int delegate() should be implicitly castable to const(int) delegate()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 27 07:10:14 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3267

           Summary: int delegate() should be implicitly castable to
                    const(int) delegate()
           Product: D
           Version: 2.031
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au


Test case:
---
void foo(const int x) {
   int delegate(int t) bar = (int t){ return x; };
}
------
bug.d(3): Error: cannot implicitly convert expression (__dgliteral1) of type c
onst(int) delegate(int t) to int delegate(int t)
----
// But this one works....
void foo(const int x) {
   int delegate(int t) bar = (int t){ return x+0; };
}

I think the reason for this is that 
TypeDelegate::implicitConvTo() is not defined.
It should allow implicit conversions of return value between type const(T),
immutable(T), and type T, when T is a value type. Certainly for delegate
literals.

-- 
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