| 1 |
/* REQUIRED_ARGS: -preview=dip1000 |
| 2 |
* This case winds up calling buildScopeRef() with stc having only STC.return_ set. |
| 3 |
*/ |
| 4 |
|
| 5 |
struct PackedPtrImpl(size_t bits) |
| 6 |
{ |
| 7 |
pure nothrow: |
| 8 |
this(inout(size_t)* ptr) inout @safe @nogc |
| 9 |
{ |
| 10 |
origin = ptr; |
| 11 |
} |
| 12 |
size_t* origin; |
| 13 |
} |
| 14 |
|
| 15 |
void test() |
| 16 |
{ |
| 17 |
size_t* p; |
| 18 |
const ppi = const(PackedPtrImpl!(3))(p); |
| 19 |
} |
| 20 |
|
| 21 |
/************************************************/ |
| 22 |
|
| 23 |
// issues.dlang.org/show_bug.cgi?id=22541 |
| 24 |
|
| 25 |
struct S |
| 26 |
{ |
| 27 |
int i; |
| 28 |
int* ptr; |
| 29 |
|
| 30 |
int* wannabeReturnRef() scope return |
| 31 |
{ |
| 32 |
return &i; |
| 33 |
} |
| 34 |
} |