D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8593 - CT out of bounds checks sometimes skipped
Summary: CT out of bounds checks sometimes skipped
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2012-08-27 08:11 UTC by Andrej Mitrovic
Modified: 2012-08-27 08:19 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2012-08-27 08:11:09 UTC
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 Andrej Mitrovic 2012-08-27 08:19:24 UTC
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.