Bug 8942 – `alias <qualifier> <type>` ignores <qualifier> in foreach over tuple
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-11-02T08:39:00Z
Last change time
2012-11-08T02:31:24Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
verylonglogin.reg
Comments
Comment #0 by verylonglogin.reg — 2012-11-02T08:39:32Z
Qualifier is ignored in foreach over tuple if there is no parantheses:
---
alias const int A0;
static assert(is(A0 == const int)); // passes
void main()
{
alias const int A1;
static assert(is(A1 == const int)); // passes
static struct S { int i; }
foreach(Unused; typeof(S.tupleof))
{
alias const(int) A2_;
static assert(is(A2_ == const int)); // also passes
alias const int A2;
static assert(is(A2 == const int)); // fails
// Error: static assert (is(int == const(int))) is false
}
}
---
As always, such (unexpected) template bugs are hard to figure out.