| 1 |
// REQUIRED_ARGS: -checkaction=context |
| 2 |
struct STuple { |
| 3 |
bool opEquals(STuple) { return false; } |
| 4 |
} |
| 5 |
|
| 6 |
class CTuple { |
| 7 |
} |
| 8 |
|
| 9 |
void testStruct() { |
| 10 |
STuple t1; |
| 11 |
assert(t1 == t1); |
| 12 |
} |
| 13 |
|
| 14 |
void testClass() { |
| 15 |
CTuple t1 = new CTuple(); |
| 16 |
assert(t1 == t1); |
| 17 |
} |
| 18 |
|
| 19 |
// https://issues.dlang.org/show_bug.cgi?id=20331 |
| 20 |
void testAnonymousFunction() |
| 21 |
{ |
| 22 |
bool function() check = () => true; |
| 23 |
assert(check()); |
| 24 |
|
| 25 |
bool result = true; |
| 26 |
assert((() => result)()); |
| 27 |
} |
| 28 |
|
| 29 |
void main() { |
| 30 |
testStruct(); |
| 31 |
testClass(); |
| 32 |
testAnonymousFunction(); |
| 33 |
} |
| 34 |
|
| 35 |
// https://issues.dlang.org/show_bug.cgi?id=20989 |
| 36 |
void test20989() @safe |
| 37 |
{ |
| 38 |
uint[] arr = [1, 2, 3]; |
| 39 |
assert(arr.ptr); |
| 40 |
assert(!arr.ptr); |
| 41 |
assert(arr.ptr is arr.ptr); |
| 42 |
} |
| 43 |
|
| 44 |
// https://issues.dlang.org/show_bug.cgi?id=21765 |
| 45 |
ref int func21765(int); |
| 46 |
void test21765() |
| 47 |
{ |
| 48 |
assert((func21765(1) = 2) == 2); |
| 49 |
assert((1.func21765 = 2) == 2); |
| 50 |
} |