MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail20033.d
blobf641469c3dcda4b7d5644cbffa01bd0fb8045101
1 // REQUIRED_ARGS: -de
2 /*
3 TEST_OUTPUT:
4 ---
5 fail_compilation/fail20033.d(38): Deprecation: `alias byKeyValue this` is deprecated - This was a bad idea
6 fail_compilation/fail20033.d(39): Deprecation: `alias byKeyValue this` is deprecated
7 fail_compilation/fail20033.d(41): Deprecation: `alias byKeyValue this` is deprecated - This was a bad idea
8 fail_compilation/fail20033.d(42): Deprecation: `alias byKeyValue this` is deprecated
9 ---
11 #line 1
12 struct Tuple(T...)
14 T values;
15 alias values this;
18 alias KVT = Tuple!(string, string);
20 struct Test {
21 struct Range {
22 bool empty () { return false; }
23 KVT front() { return KVT.init; }
24 void popFront() {}
27 auto byKeyValue () { return Range.init; }
29 deprecated("This was a bad idea")
30 alias byKeyValue this;
33 struct Test2 {
34 struct Range {
35 bool empty () { return false; }
36 KVT front() { return KVT.init; }
37 void popFront() {}
40 auto byKeyValue () { return Range.init; }
42 deprecated alias byKeyValue this;
45 void main ()
47 foreach (k, v; Test.init.byKeyValue) {} // Fine
48 foreach (k, v; Test2.init.byKeyValue) {} // Fine
49 foreach (k, v; Test.init) {} // Fails
50 foreach (k, v; Test2.init) {} // Fails
52 auto f1 = Test.init.front(); // Fails
53 auto f2 = Test2.init.front(); // Fails