Debian Codegraph @

gcc/testsuite/gdc.test/runnable/test13944.d

raw
1 // PERMUTE_ARGS:
2 module m;
3
4 struct S {}
5 enum E { a }
6 void f() {}
7
8 void main()
9 {
10 string ssc = S.stringof; assert(ssc == "S"c);
11 wstring ssw = S.stringof; assert(ssw == "S"w);
12 dstring ssd = S.stringof; assert(ssd == "S"d);
13
14 string esc = E.stringof; assert(esc == "E"c);
15 wstring esw = E.stringof; assert(esw == "E"w);
16 dstring esd = E.stringof; assert(esd == "E"d);
17
18 string msc = m.stringof; assert(msc == "module m"c);
19 wstring msw = m.stringof; assert(msw == "module m"w);
20 dstring msd = m.stringof; assert(msd == "module m"d);
21
22 string smc = S.mangleof; assert(smc == "S1m1S"c);
23 wstring smw = S.mangleof; assert(smw == "S1m1S"w);
24 dstring smd = S.mangleof; assert(smd == "S1m1S"d);
25
26 string fmc = f.mangleof; assert(fmc == "_D1m1fFZv"c);
27 wstring fmw = f.mangleof; assert(fmw == "_D1m1fFZv"w);
28 dstring fmd = f.mangleof; assert(fmd == "_D1m1fFZv"d);
29
30 // The default type is still string
31 static assert(is(typeof(S.stringof) == string));
32 static assert(is(typeof(E.stringof) == string));
33 static assert(is(typeof(m.stringof) == string));
34 static assert(is(typeof(S.mangleof) == string));
35 static assert(is(typeof(f.mangleof) == string));
36 }