d: Merge upstream dmd, druntime 26f049fb26, phobos 330d6a4fd.
[official-gcc.git] / gcc / testsuite / gdc.test / compilable / test10066.d
blobfc3ffe2cb3c41d43193c940e3065c5909eca5e24
1 void main()
3 alias Zoo = Foo!(1);
6 struct Foo(size_t N)
8 string bar()
10 Appender!(string) w;
11 char[] buf; put(w, buf);
12 return "";
15 public bool opEquals(T)(T other) const
16 // Add const, different from bug 10056
18 alias Foo!(typeof(this), T, "CMP") P;
19 return false;
23 template Foo(T, U, string OP)
25 static if (T.ISEMPTY && U.ISEMPTY)
26 enum bool S = false;
27 else
28 enum bool S = false;
30 alias Foo = Foo!(0);
33 /**********************************************/
35 void put(R, E)(ref R r, E e)
37 static if (is(typeof(r.put(e))))
39 r.put(e);
41 else
43 static assert(false, "Cannot put a "~E.stringof~" into a "~R.stringof);
47 struct Appender(A : T[], T)
49 private template canPutItem(U)
51 enum bool canPutItem = is(U : T);
53 private template canPutRange(R)
55 enum bool canPutRange = is(typeof(Appender.init.put(R.init[0])));
58 void put(U)(U item) if (canPutItem!U)
60 char[T.sizeof == 1 ? 4 : 2] encoded;
61 put(encoded[]);
63 void put(R)(R items) if (canPutRange!R)