[Issue 6928] New: alias this, immutable and common type fail in presence of fields with indirections

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 10 08:25:08 PST 2011


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

           Summary: alias this, immutable and common type fail in presence
                    of fields with indirections
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: timon.gehr at gmx.ch


--- Comment #0 from timon.gehr at gmx.ch 2011-11-10 08:24:28 PST ---
T x;
struct S{
    T get() const {return x;}
    alias get this;
}
struct T{int* p;} // p is necessary.

immutable(S) s; 
immutable(T) t;

static assert(is(typeof(1? s:t))); // ok.
static assert(is(typeof(1? t:s))); // ok.

static assert(is(typeof(1? s:t)==typeof(1? t:s))); // fail.


void main(){
    auto x = 1? t:s; // ok.
    auto y = 1? s:t; // compile error.
}

The code should compile fine.

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