Bug 22871 – Using an alias to `__traits(parameters)` causes unknown error
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-03-11T14:18:50Z
Last change time
2022-03-27T02:24:35Z
Keywords
pull
Assigned to
No Owner
Creator
moonlightsentinel
Comments
Comment #0 by moonlightsentinel — 2022-03-11T14:18:50Z
E.g.
int makeAlias(int a, bool b)
{
alias Params = __traits(parameters);
assert(Params[0] == 3);
assert(Params[1] == true);
return 1;
}
Error: unknown, please file report on issues.dlang.org
Comment #1 by dlang-bot — 2022-03-11T14:29:26Z
@MoonlightSentinel created dlang/dmd pull request #13804 "alias parameters" fixing this issue:
- Fix 22871 - Support aliases to __traits(parameters).
The current implementation had two bugs preventing users from using
the tuple returned by `__traits(parameters)` bound to an alias:
- the parser rejected `typeof(__traits(X))`, i.e. a traits without
parameters. Fixed by removing the check for existing arguments.
- type semantic rejected the alias as invalid and eagerly issued an
error. Fixed by extending the list of viable traits.
https://github.com/dlang/dmd/pull/13804
Comment #2 by dlang-bot — 2022-03-14T07:49:53Z
dlang/dmd pull request #13804 "Fix 22871 - Support aliases to __traits(parameters)" was merged into stable:
- a7e2d14159b9dfa790e8784e86c477248f299503 by MoonlightSentinel:
Fix 22871 - Support aliases to __traits(parameters).
The current implementation had two bugs preventing users from using
the tuple returned by `__traits(parameters)` bound to an alias:
- the parser rejected `typeof(__traits(X))`, i.e. a traits without
parameters. Fixed by removing the check for existing arguments.
- type semantic rejected the alias as invalid and eagerly issued an
error. Fixed by extending the list of viable traits.
https://github.com/dlang/dmd/pull/13804
Comment #3 by dlang-bot — 2022-03-27T02:24:35Z
dlang/dmd pull request #13892 "Merge stable into master" was merged into master:
- cc3c1deb0a8cf639ed25089714280046682ae533 by Florian:
Fix 22871 - Support aliases to __traits(parameters). (#13804)
The current implementation had two bugs preventing users from using
the tuple returned by `__traits(parameters)` bound to an alias:
- the parser rejected `typeof(__traits(X))`, i.e. a traits without
parameters. Fixed by removing the check for existing arguments.
- type semantic rejected the alias as invalid and eagerly issued an
error. Fixed by extending the list of viable traits.
https://github.com/dlang/dmd/pull/13892