Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/fail23406.d

raw
1 // https://issues.dlang.org/show_bug.cgi?id=23406
2
3 /*
4 TEST_OUTPUT:
5 ---
6 fail_compilation/fail23406.d(39): Error: cannot implicitly convert expression `0` of type `int` to `alphakey`
7 ---
8 */
9
10 struct flagenum
11 {
12 int i = 1;
13 alias i this;
14
15 auto opBinary(string s)(int j)
16 {
17 assert(j == 1);
18 return typeof(this)(i*2);
19 }
20
21 auto opEquals(int a)
22 {
23 return false;
24 }
25 }
26
27 enum alphakey
28 {
29 a = flagenum(),
30 b,c,d,e,f,g,h,i,
31 k,l,m,n,o,p,q,r,
32 s,t,u,v,w,x,y,z
33 }
34
35 alphakey alpha;
36
37 void main()
38 {
39 alpha = 0;
40 }