www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10114] New: Some implicit conversions to immutable and shared should be allowed

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10114

           Summary: Some implicit conversions to immutable and shared
                    should be allowed
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bugzilla digitalmars.com



23:41:07 PDT ---
The following should work:
--------------------------
struct S {
    int a;
    immutable(int)* p;
}

struct T {
    int a;
    shared(int)* p;
}

void main() {
    auto s = S();
    immutable(S)*p = &s; // cannot implicitly convert expression
                         // (& s) of type S* to immutable(S)*

    shared(S)* q = &s; // cannot implicitly convert expression
                       // (& s) of type S* to shared(S)*

    auto t = T();
    shared(T)* r = &t; // cannot implicitly convert expression
                       // (& t) of type T* to shared(T)*
}
---------------------------

It should also work not only with pointers, but all reference types (such as
dynamic arrays).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 17 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10114


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID



00:26:38 PDT ---
ack, what was I thinking

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 18 2013