d: Merge upstream dmd 568496d5b, druntime 178c44ff, phobos 574bf883b.
[official-gcc.git] / gcc / testsuite / gdc.test / compilable / test10726.d
blob3db2f807ab21580e788d3d11526975ad7fa79ddf
1 // PERMUTE_ARGS:
3 public struct CirBuff(T)
5 private T[] data;
6 private size_t head = 0;
7 private size_t size = 0;
8 public size_t length() const { return size; }
10 public bool opEquals(CirBuff!T d) @trusted
12 if (length != d.length)
13 return false;
14 for (size_t i=0; i!=size; ++i)
16 if (this.data[(this.head+i) % this.data.length] !=
17 d.data[(d.head + i) % d.data.length])
19 return false;
22 return true;
26 class Once
28 Foo!Bar _bar;
31 class Bar
33 static Once _once;
34 mixin(sync!(Once, "_once"));
37 class Foo(T = int)
39 CirBuff!T _buff;
42 template sync(T, string U = "this", size_t ITER = 0)
44 static if (ITER == __traits(derivedMembers, T).length)
45 enum sync = "";
46 else
48 enum string mem = __traits(derivedMembers, T)[ITER];
49 enum string sync =
50 "static if(! __traits(isVirtualMethod, " ~ U ~ "." ~ mem ~ ")) { }"
51 ~ sync!(T, U, ITER+1);