| 1 |
// EXTRA_FILES: imports/imp22122.d |
| 2 |
module imports.test22122; |
| 3 |
|
| 4 |
struct S22122 |
| 5 |
{ |
| 6 |
import imports.imp22122; |
| 7 |
Variant!(Imp22122)[] array; |
| 8 |
} |
| 9 |
|
| 10 |
void test22122_catch(S22122 s) |
| 11 |
{ |
| 12 |
try |
| 13 |
{ |
| 14 |
foreach(elem; s.array) |
| 15 |
{ |
| 16 |
import imports.imp22122; |
| 17 |
with(elem.get!Imp22122) |
| 18 |
{ |
| 19 |
} |
| 20 |
} |
| 21 |
} |
| 22 |
catch (Exception) |
| 23 |
{ |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
void test22122_finally(S22122 s) |
| 28 |
{ |
| 29 |
try |
| 30 |
{ |
| 31 |
foreach(elem; s.array) |
| 32 |
{ |
| 33 |
import imports.imp22122; |
| 34 |
with(elem.get!Imp22122) |
| 35 |
{ |
| 36 |
} |
| 37 |
} |
| 38 |
} |
| 39 |
finally |
| 40 |
{ |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
private struct Variant(T) |
| 45 |
{ |
| 46 |
union Impl |
| 47 |
{ |
| 48 |
} |
| 49 |
auto get(E)() |
| 50 |
{ |
| 51 |
return Impl(); |
| 52 |
} |
| 53 |
} |