d: Merge upstream dmd 568496d5b, druntime 178c44ff, phobos 574bf883b.
[official-gcc.git] / gcc / testsuite / gdc.test / compilable / aliasdecl.d
blob5bacbc623473b6c9ec57e1951f25df09fd6b08f1
1 template Test(T){ alias Type = T; }
3 alias X1 = int;
4 static assert(is(X1 == int));
6 alias X2 = immutable(long)[], X3 = shared const double[int];
7 static assert(is(X2 == immutable(long)[]));
8 static assert(is(X3 == shared const double[int]));
10 alias X4 = void delegate() const, X5 = Test!int;
11 static assert(is(X4 == void delegate() const));
12 static assert(is(X5.Type == int));
14 alias FP5 = extern(C) pure nothrow @safe @nogc void function(),
15 DG5 = extern(D) pure nothrow @safe @nogc void delegate();
16 static assert(FP5.stringof == "extern (C) void function() pure nothrow " /* ~ "@safe " */ ~ "@nogc");
17 static assert(DG5.stringof == "void delegate() pure nothrow " /* ~ "@safe " */ ~ "@nogc");
19 void main()
21 alias Y1 = int;
22 static assert(is(Y1 == int));
24 alias Y2 = immutable(long)[], Y3 = shared const double[int];
25 static assert(is(Y2 == immutable(long)[]));
26 static assert(is(Y3 == shared const double[int]));
28 alias Y4 = void delegate() const, Y5 = Test!int;
29 static assert(is(Y4 == void delegate() const));
30 static assert(is(Y5.Type == int));
32 // https://issues.dlang.org/show_bug.cgi?id=18429
33 struct S
35 alias a this;
36 enum a = 1;
39 /+ struct S
41 int value;
42 alias this = value;
44 auto s = S(10);
45 int n = s;
46 assert(n == 10); +/