| 1 |
module imports.link15194std; |
| 2 |
|
| 3 |
// std.algorithm.setopts |
| 4 |
|
| 5 |
/* setUnion template function is instantiated in module link15194 as root, |
| 6 |
* and linked into executable. |
| 7 |
* |
| 8 |
* - In "original case", due to link to typeid(const RBRange!(RBNode!int*)), |
| 9 |
* unSpeculative should be called for the type of typeid operand. |
| 10 |
* |
| 11 |
* - In "additional case", typeid(const RBRange!(RBNode!int*)*) returns |
| 12 |
* TypeInfo_Pointer instance. But later its 'next' field access will reference |
| 13 |
* RBRange instance. Therefore typeid should also unSpeculative the bottom struct |
| 14 |
* of operand type. |
| 15 |
*/ |
| 16 |
version (A) |
| 17 |
{ |
| 18 |
// additional case |
| 19 |
|
| 20 |
TypeInfo setUnion(Rs...)(Rs ) |
| 21 |
{ |
| 22 |
return typeid(const Rs[0]*).next; |
| 23 |
|
| 24 |
// semanticTypeInfo should also unSpaculate TypePointer.next. |
| 25 |
} |
| 26 |
} |
| 27 |
else |
| 28 |
{ |
| 29 |
// original case |
| 30 |
|
| 31 |
struct SetUnion(Rs...) |
| 32 |
{ |
| 33 |
Rs r; |
| 34 |
|
| 35 |
// Rs[0] == RBRange!(RBNode!int*) |
| 36 |
// Rs[1] == int[] |
| 37 |
|
| 38 |
// size_t toHash() is implicitly generated by buildXtoHash. |
| 39 |
// And from that, |
| 40 |
// typeid(const RBRange!(RBNode!int*)) |
| 41 |
// and |
| 42 |
// typeid(const int[]) |
| 43 |
// are referenced to invoke TypeInfo.getHash(). |
| 44 |
} |
| 45 |
|
| 46 |
SetUnion!(Rs) setUnion(Rs...)(Rs ) |
| 47 |
{ |
| 48 |
return typeof(return)(); |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
// std.container.rbtree |
| 53 |
|
| 54 |
struct RBNode(V) {} |
| 55 |
|
| 56 |
struct RBRange(N) {} |
| 57 |
|
| 58 |
class RedBlackTree(Elem) |
| 59 |
{ |
| 60 |
alias Range = RBRange!(RBNode!Elem*); |
| 61 |
|
| 62 |
Range opSlice() |
| 63 |
{ |
| 64 |
return Range(); |
| 65 |
} |
| 66 |
} |