Debian Codegraph @

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

raw
1 /*
2 REQUIRED_ARGS: -checkaction=context
3 TEST_OUTPUT:
4 ---
5 fail_compilation/dassert.d(14): Error: expression `AliasSeq!(0, 0)` of type `(int, int)` does not have a boolean value
6 fail_compilation/dassert.d(21): Error: assignment cannot be used as a condition, perhaps `==` was meant?
7 fail_compilation/dassert.d(29): Error: assignment cannot be used as a condition, perhaps `==` was meant?
8 fail_compilation/dassert.d(40): Error: expression `issue()` of type `void` does not have a boolean value
9 ---
10 */
11 #line 10
12
13 struct Baguette { int bread, floor; }
14 void main ()
15 {
16 assert(Baguette.init.tupleof);
17 }
18
19 // https://issues.dlang.org/show_bug.cgi?id=21590
20 void issue21590()
21 {
22 int a, b = 1;
23 assert (a = b);
24
25 static ref int get()
26 {
27 static int i;
28 return i;
29 }
30
31 assert(get() = 1);
32
33 // No errors for binary assignments (regardless of -checkaction=context)
34 int[] arr;
35 assert(arr ~= 1);
36 assert(a += b);
37 }
38
39 // https://issues.dlang.org/show_bug.cgi?id=21798
40 void issue()
41 {
42 assert(issue());
43 }