| 1 |
// PERMUTE_ARGS: -w -wi -debug |
| 2 |
@safe pure nothrow void strictVoidReturn(T)(T x) {} |
| 3 |
@safe pure nothrow void nonstrictVoidReturn(T)(ref T x) {} |
| 4 |
|
| 5 |
void test3882() |
| 6 |
{ |
| 7 |
int x = 3; |
| 8 |
strictVoidReturn(x); |
| 9 |
nonstrictVoidReturn(x); |
| 10 |
} |
| 11 |
|
| 12 |
/******************************************/ |
| 13 |
// https://issues.dlang.org/show_bug.cgi?id=12619 |
| 14 |
|
| 15 |
extern (C) @system nothrow pure void* memcpy(void* s1, const void* s2, size_t n); |
| 16 |
// -> weakly pure |
| 17 |
|
| 18 |
void test12619() pure |
| 19 |
{ |
| 20 |
ubyte[10] a, b; |
| 21 |
debug memcpy(a.ptr, b.ptr, 5); // memcpy call should have side effect |
| 22 |
} |
| 23 |
|
| 24 |
/******************************************/ |
| 25 |
// https://issues.dlang.org/show_bug.cgi?id=12760 |
| 26 |
|
| 27 |
struct S12760(T) |
| 28 |
{ |
| 29 |
T i; |
| 30 |
this(T j) inout {} |
| 31 |
} |
| 32 |
|
| 33 |
struct K12760 |
| 34 |
{ |
| 35 |
S12760!int nullable; |
| 36 |
|
| 37 |
this(int) |
| 38 |
{ |
| 39 |
nullable = 0; // weak purity |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
/******************************************/ |
| 44 |
// https://issues.dlang.org/show_bug.cgi?id=12909 |
| 45 |
|
| 46 |
int f12909(immutable(int[])[int] aa) pure nothrow |
| 47 |
{ |
| 48 |
//aa[0] = []; // fix for https://issues.dlang.org/show_bug.cgi?id=13701 |
| 49 |
return 0; |
| 50 |
} |
| 51 |
|
| 52 |
void test12909() |
| 53 |
{ |
| 54 |
immutable(int[])[int] aa; |
| 55 |
f12909(aa); |
| 56 |
|
| 57 |
// from 12910 |
| 58 |
const(int[])[int] makeAA() { return null; } // to make r-value |
| 59 |
makeAA().rehash(); |
| 60 |
} |
| 61 |
|
| 62 |
/******************************************/ |
| 63 |
// https://issues.dlang.org/show_bug.cgi?id=13899 |
| 64 |
|
| 65 |
const struct Foo13899 |
| 66 |
{ |
| 67 |
int opApply(immutable int delegate(const ref int) pure nothrow dg) pure nothrow |
| 68 |
{ |
| 69 |
return 1; |
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
void test13899() |
| 74 |
{ |
| 75 |
foreach (x; Foo13899()) |
| 76 |
{ |
| 77 |
} |
| 78 |
} |