Bug 23863 – `typeof` rejects `AliasSeq!()` as argument

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2023-04-26T07:07:38Z
Last change time
2023-04-29T19:35:21Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
Max Samukha

Comments

Comment #0 by maxsamukha — 2023-04-26T07:07:38Z
import std.meta: AliasSeq; struct S { } alias Empty = S.tupleof; Empty x; // accepts valid AliasSeq!() x2 = AliasSeq!(); // accepts valid static assert(is(typeof(S.tupleof) == AliasSeq!())); // accepts valid static assert(is(typeof(Empty) == AliasSeq!())); // rejects valid static assert(is(typeof(AliasSeq!()) == AliasSeq!())); // rejects valid ---- This bug causes problems for generic code. For example: import std.meta: Filter; struct S { int x; } template Const(alias value) { enum Const(A...) = value; } typeof(Filter!(Const!true, S.tupleof)) s1; // passes // but this fails - a special case is required for the empty tuple typeof(Filter!(Const!false, S.tupleof)) s2;
Comment #1 by dlang-bot — 2023-04-28T10:13:04Z
@RazvanN7 created dlang/dmd pull request #15140 "Fix Issue 23863 - rejects as argument" fixing this issue: - Fix Issue 23863 - rejects as argument https://github.com/dlang/dmd/pull/15140
Comment #2 by dlang-bot — 2023-04-29T19:35:21Z
dlang/dmd pull request #15140 "Fix Issue 23863 - typeof rejects AliasSeq!() as argument" was merged into master: - 509a7676a43e5265267d3a7a8d7674eaa99ff508 by RazvanN7: Fix Issue 23863 - typeof rejects AliasSeq!() as argument https://github.com/dlang/dmd/pull/15140