Debian Codegraph @

gcc/testsuite/gdc.dg/torture/pr106623.d

raw
1 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106623
2 // { dg-do compile }
3 private struct _Complex(T) { T re; T im; }
4 enum __c_complex_double : _Complex!double;
5
6 pragma(inline, true)
7 ulong hashOf()(scope const double val)
8 {
9 return *cast(ulong*)&val;
10 }
11
12 pragma(inline, true)
13 ulong hashOf()(scope const _Complex!double val, ulong seed = 0)
14 {
15 return hashOf(val.re) + hashOf(val.im);
16 }
17
18 pragma(inline, true)
19 ulong hashOf()(__c_complex_double val, ulong seed = 0)
20 {
21 return hashOf(cast(_Complex!double) val, seed);
22 }
23
24 ulong test106623()
25 {
26 __c_complex_double val;
27 return hashOf(val);
28 }