Mercurial > projects > ldc
comparison tests/mini/bug199_ctfestructinit.d @ 913:29c0d1194033
Fix #198 and #199 by making CTFE on static struct initializers work.
Renamed SymbolDeclaration to StaticStructInitDeclaration to make its usage clearer.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 01 Feb 2009 20:20:56 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
912:16264a3973bf | 913:29c0d1194033 |
---|---|
1 struct Color { | |
2 uint c; | |
3 | |
4 } | |
5 | |
6 struct Vertex { | |
7 double x, y; | |
8 Color c; | |
9 static Vertex opCall(double x, double y, Color c) { | |
10 Vertex ret; | |
11 ret.x = x; | |
12 ret.y = y; | |
13 ret.c = c; | |
14 return ret; | |
15 } | |
16 } | |
17 | |
18 void main() { | |
19 Color c = {0xffffffff}; | |
20 | |
21 auto v = Vertex(1, 5, c); | |
22 | |
23 assert(v.x == 1 && v.y == 5); // passes | |
24 assert(v.c.c == 0xffffffff); // fails in LDC | |
25 } |