Debian Codegraph @

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

raw
1 /***************************************/
2 // https://issues.dlang.org/show_bug.cgi?id=17965
3
4 import core.stdc.math;
5
6 struct Point{double x,y;}
7
8 Point foo10()
9 {
10 Point result = Point(1.0, 2.0);
11 return result;
12 }
13
14 Point foo20()
15 {
16 Point result;
17 return result;
18 }
19
20 void main()
21 {
22 auto p = foo10();
23 assert(p.x == 1.0);
24 assert(p.y == 2.0);
25
26 auto q = foo20();
27 assert(isnan(q.x));
28 assert(isnan(q.y));
29 }