View source code
Display the source code in dmd/funcsem.d from which thispage was generated on github.
Report a bug
If you spot a problem with this page, click here to create aBugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinglocal clone.

Function dmd.funcsem.traverseIndirections

Performs type-based alias analysis between a newly created value and a pre- existing memory reference:

bool traverseIndirections(
  Type ta,
  Type tb
);

Assuming that a reference A to a value of type ta was available to the code that created a reference B to a value of type tb, it returns whether B might alias memory reachable from A based on the types involved (either directly or via any number of indirections in either A or B).

This relation is not symmetric in the two arguments. For example, a a const(int) reference can point to a pre-existing int, but not the other way round.

Examples

ta, tb, result const(int), int, false int, const(int), true int, immutable(int), false const(immutable(int)*), immutable(int)*, false // BUG: returns true

Parameters

NameDescription
ta value type being referred to
tb referred to value type that could be constructed from ta

Returns

true if reference to tb is isolated from reference to ta

Authors

Walter Bright

License

Boost License 1.0