| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/nestedtempl1.d(14): Deprecation: function `nestedtempl1.main.bar!(a).bar` function requires a dual-context, which is deprecated |
| 5 |
fail_compilation/nestedtempl1.d(26): instantiated from here: `bar!(a)` |
| 6 |
fail_compilation/nestedtempl1.d(26): Error: modify `inout` to `mutable` is not allowed inside `inout` function |
| 7 |
--- |
| 8 |
*/ |
| 9 |
|
| 10 |
auto foo(ref inout(int) x) |
| 11 |
{ |
| 12 |
struct S |
| 13 |
{ |
| 14 |
ref inout(int) bar(alias a)() inout |
| 15 |
{ |
| 16 |
return x; |
| 17 |
} |
| 18 |
} |
| 19 |
return S(); |
| 20 |
} |
| 21 |
|
| 22 |
void main() |
| 23 |
{ |
| 24 |
int a; |
| 25 |
auto o = foo(a); |
| 26 |
o.bar!a() = 1; // bad! |
| 27 |
} |