www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1938] New: member of scope-class-type behavior undefined


           Summary: member of scope-class-type behavior undefined
           Product: D
           Version: 1.028
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: davidl 126.com

scope class A
class B
        A t;   // possible way of embedding A t as C++ class-type
               // members. in D we only gets A *t corresponding C++ code.
               // this gives great optimization of not heap allocating 
               // twice. sizeof(B) will count in embeded A members.
               // in real world each B object gets an A instance embeded,
               // therefore calling of allocating space for A is saved,
               // yet you still need to invoke C-tors of A. There init-list
               // becomes useful. 
               // D2.0 traits stuff should still behave in the old way.
            printf ("B !!");
void main()
    B b;
    b = new B;

testd.d(11): variable testd.B.t globals, statics, fields, ref and out
parameters cannot be auto
testd.d(11): variable testd.B.t reference to scope class must be scope

Mar 24 2008