Bug 8593 – CT out of bounds checks sometimes skipped
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-08-27T08:11:00Z
Last change time
2012-08-27T08:19:24Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2012-08-27T08:11:09Z
This compiles but it should give a CT error since x[4] is out of bounds:
import std.typetuple;
void main()
{
alias TypeTuple!(int) x;
static if (is(x[4] == int))
{
}
}
This correctly gives the error message, 'int' and 'x[4]' just swapped places:
import std.typetuple;
void main()
{
alias TypeTuple!(int) x;
static if (is(int == x[4]))
{
}
}
test.d(17): Error: tuple index 4 exceeds 1
Comment #1 by andrej.mitrovich — 2012-08-27T08:19:24Z
Timon Gehr:
Actually it is according to the specification:
"3. is ( Type == TypeSpecialization )
The condition is satisfied if Type is semantically correct and is the same type as TypeSpecialization."
=> TypeSpecialization is compiled without suppressing errors.