]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gdc.test/compilable/test10993.d
d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1)
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / compilable / test10993.d
CommitLineData
b4c522fa
IB
1module test10993;
2
5fee5ec3
IB
3import core.demangle : demangleType;
4
b4c522fa
IB
5auto foo(T)(T a)
6{
7 static immutable typeof(a) q;
8// pragma(msg, "foo: " ~ typeof(q).mangleof);
9 return q;
10}
11
12struct test(alias fn)
13{
14 bool ini = true;
15 void* p;
16}
17
18auto fun()
19{
20 auto x = foo!()(test!(a=>a)());
21// pragma(msg, "fun: " ~ typeof(x).mangleof);
22
23 return x;
24}
25
26void main()
27{
28 const x = fun();
29 enum mangle_x = typeof(x).mangleof;
30// pragma(msg, "x : " ~ mangle_x);
31 auto y = cast()x;
32 enum mangle_y = typeof(y).mangleof;
33// pragma(msg, "y : " ~ mangle_y);
5fee5ec3
IB
34 enum demangle_x = demangleType(mangle_x);
35 enum demangle_y = demangleType(mangle_y);
36 static assert ("immutable(" ~ demangle_y ~ ")" == demangle_x);
b4c522fa 37}