Skip to content

Commit

Permalink
Merge pull request #9031 from ljmf00/fix-24686
Browse files Browse the repository at this point in the history
Fix issue 24686: SumType stopped working with unmatched DeducedParame…
  • Loading branch information
pbackus authored Aug 3, 2024
2 parents 4b61e7d + 9c11552 commit 61923d9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions std/traits.d
Original file line number Diff line number Diff line change
Expand Up @@ -9236,12 +9236,16 @@ enum isCopyable(S) = __traits(isCopyable, S);
* is the same as `T`. For pointer and slice types, it is `T` with the
* outer-most layer of qualifiers dropped.
*/
package(std) template DeducedParameterType(T)
package(std) alias DeducedParameterType(T) = DeducedParameterTypeImpl!T;
/// ditto
package(std) alias DeducedParameterType(alias T) = DeducedParameterTypeImpl!T;

private template DeducedParameterTypeImpl(T)
{
static if (is(T == U*, U) || is(T == U[], U))
alias DeducedParameterType = Unqual!T;
alias DeducedParameterTypeImpl = Unqual!T;
else
alias DeducedParameterType = T;
alias DeducedParameterTypeImpl = T;
}

@safe unittest
Expand All @@ -9261,6 +9265,7 @@ package(std) template DeducedParameterType(T)
}

static assert(is(DeducedParameterType!NoCopy == NoCopy));
static assert(is(DeducedParameterType!(inout(NoCopy)) == inout(NoCopy)));
}

@safe unittest
Expand Down

0 comments on commit 61923d9

Please sign in to comment.