[Issue 1938] New: member of scope-class-type behavior undefined
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 24 23:08:35 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1938
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 at digitalmars.com
ReportedBy: davidl at 126.com
scope class A
{
this()
{
printf("hello!");
}
}
class B
{
private:
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.
public:
this()
{
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
--
More information about the Digitalmars-d-bugs
mailing list