1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail11510.d(25): Error: reinterpretation through overlapped field y is not allowed in CTFE
5 fail_compilation/fail11510.d(29):        called from here: test11510a()
6 fail_compilation/fail11510.d(36): Error: reinterpretation through overlapped field y is not allowed in CTFE
7 fail_compilation/fail11510.d(40):        called from here: test11510b()
8 ---
9 */
10 
11 struct S11510
12 {
13     union
14     {
15         size_t x;
16         int* y; // pointer field
17     }
18 }
19 
20 bool test11510a()
21 {
22     S11510 s;
23 
24     s.y = [1,2,3].ptr;
25     auto x = s.x;   // reinterpretation
26 
27     return true;
28 }
29 enum a = test11510a();
30 
31 bool test11510b()
32 {
33     S11510 s;
34 
35     s.x = 10;
36     auto y = s.y;   // reinterpretation
37 
38     return true;
39 }
40 enum b = test11510b();
41