Skip to content

Commit

Permalink
Reduce number of tried template instances for class, interface and AA…
Browse files Browse the repository at this point in the history
… case in hasIndirections
  • Loading branch information
nordlow committed Nov 20, 2024
1 parent f1adbd1 commit 74a7fcc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions druntime/src/core/internal/traits.d
Original file line number Diff line number Diff line change
Expand Up @@ -540,13 +540,14 @@ template hasIndirections(T)
{
static if (is(T == struct) || is(T == union))
enum hasIndirections = anySatisfy!(.hasIndirections, typeof(T.tupleof));
else static if (__traits(isAssociativeArray, T) || is(T == class) || is(T == interface))
enum hasIndirections = true;
else static if (is(T == E[N], E, size_t N))
enum hasIndirections = T.sizeof && is(E == void) ? true : hasIndirections!(BaseElemOf!E);
else static if (isFunctionPointer!T)
enum hasIndirections = false;
else
enum hasIndirections = isPointer!T || isDelegate!T || isDynamicArray!T ||
__traits(isAssociativeArray, T) || is (T == class) || is(T == interface);
enum hasIndirections = isPointer!T || isDelegate!T || isDynamicArray!T;
}

template hasUnsharedIndirections(T)
Expand Down

0 comments on commit 74a7fcc

Please sign in to comment.