--- auto foo(T)(T t) if (!__traits(isDeprecated, T)) { return T.init; } deprecated auto foo(T)(T t) if (__traits(isDeprecated, T)) { return T.init; } deprecated unittest { auto b = foo(2 + 2i); } --- This shouldn't trigger a deprecation on line 1: > dmd -unittest -c -o- -transition=complex foo.d foo.d(1): Deprecation: use of complex type cdouble is deprecated, use std.complex.Complex!(double) instead foo.d(8): Deprecation: use of complex type cdouble is deprecated, use std.complex.Complex!(double) instead
Fixed since a while, but somehow this wasn't auto-closed. https://run.dlang.io/is/IM7H7c
Looks like this was never fully fixed, but the earlier run.dlang.io example simply forgot the `-transition=complex`: https://run.dlang.io/is/S9Us4A
@ibuclaw created dlang/dmd pull request #12435 "fix Issue 18251 - deprecate + transition=complex shouldn't look at functions with non-matching if constraints" fixing this issue: - fix Issue 18251 - deprecate + transition=complex shouldn't look at functions with non-matching if constraints https://github.com/dlang/dmd/pull/12435
dlang/dmd pull request #12435 "fix Issue 18251 - deprecate + transition=complex shouldn't look at functions with non-matching if constraints" was merged into master: - 5ae6003839b175249bcaa1159b8aa8a4b3bcd577 by Iain Buclaw: fix Issue 18251 - deprecate + transition=complex shouldn't look at functions with non-matching if constraints https://github.com/dlang/dmd/pull/12435