ubuntu-buildroot/output/build/host-gcc-initial-11.4.0/gcc/testsuite/gdc.dg/gdc218.d

42 lines
473 B
D
Raw Permalink Normal View History

2024-04-01 15:19:46 +00:00
// https://bugzilla.gdcproject.org/show_bug.cgi?id=218
// { dg-do compile }
struct S218a
{
this(int* pdata_)
{
pdata = pdata_;
}
void opIndexAssign(int, size_t) { }
int* pdata;
};
struct S218
{
S218a getS218a()
{
return S218a(data.ptr);
}
int[] data;
int[] tab2;
};
S218 f()
{
S218 r;
for(int i = 0; i < 1; ++i)
r.getS218a()[0] = 0;
return r;
}
S218 var;
static this()
{
var = f();
}