1 /* REQUIRED_ARGS: -o- -de
2 TEST_OUTPUT:
3 ---
4 fail_compilation/commaexp.d(24): Deprecation: Using the result of a comma expression is deprecated
5 fail_compilation/commaexp.d(36): Deprecation: Using the result of a comma expression is deprecated
6 fail_compilation/commaexp.d(37): Deprecation: Using the result of a comma expression is deprecated
7 fail_compilation/commaexp.d(38): Deprecation: Using the result of a comma expression is deprecated
8 fail_compilation/commaexp.d(39): Deprecation: Using the result of a comma expression is deprecated
9 fail_compilation/commaexp.d(41): Deprecation: Using the result of a comma expression is deprecated
10 fail_compilation/commaexp.d(42): Deprecation: Using the result of a comma expression is deprecated
11 ---
12 */
13
14 class Entry {}
append(Entry)15 class MyContainerClass { bool append (Entry) { return false; } }
16
main()17 int main () {
18 bool ok;
19 size_t aggr;
20 MyContainerClass mc;
21
22 // Bug 15997
23 enum WINHTTP_ERROR_BASE = 4200;
24 enum ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED = (WINHTTP_ERROR_BASE, + 44);
25
26 // OK
27 for (size_t i; i < 5; ++i, i += 1) {}
28 for (size_t i; i < 5; ++i, i += 1, i++) {}
29 if (!mc)
30 mc = new MyContainerClass, mc.append(new Entry);
31 if (Object o = cast(Object)mc) {} // Lowering
32 ok = true, mc.append(new Entry);
33 assert(ok);
34
35 // NOPE
36 for (size_t i; i < 5; ++i, i += (i++, 1)) {}
37 for (; aggr++, aggr > 5;) {}
38 if (Object o = (ok = true, null)) {}
39 ok = (true, mc.append(new Entry));
40 assert(!ok);
41 ok = true, (ok = (true, false));
42 return 42, 0;
43 }
44