www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3267] New: int delegate() should be implicitly castable to const(int) delegate()

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: clugdbug 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: -------
Aug 27 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3267


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |DUPLICATE



*** 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: -------
Sep 06 2011