Bug 9562 – Built-in runtime properties should become error with `Type.prop`
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-02-21T18:40:00Z
Last change time
2013-11-23T18:38:05Z
Keywords
accepts-invalid, diagnostic, pull
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2013-02-21T18:40:42Z
This code succeeds to compile with -o- switch.
It means that front-end allows such a meaningless expression, (int[]).length.
void main()
{
foreach (A; TypeTuple!(int[1], char[1], int[], char[]))
{
auto len = A.length;
auto rev = A.reverse;
auto sort = A.sort;
auto dup = A.dup;
auto idup = A.idup;
}
}
Of course, the invalid expressions will fail code generation in glue layer, but it is little late.
Comment #1 by yebblies — 2013-11-16T21:46:05Z
Fails now:
testx.d(9): Error: type int[1] is not an expression
testx.d(10): Error: type int[1] is not an expression
testx.d(11): Error: type int[1] is not an expression
testx.d(12): Error: type int[1] is not an expression
testx.d(9): Error: type char[1] is not an expression
testx.d(10): Error: type char[1] is not an expression
testx.d(11): Error: type char[1] is not an expression
testx.d(12): Error: type char[1] is not an expression
testx.d(8): Error: type int[] is not an expression
testx.d(9): Error: type int[] is not an expression
testx.d(10): Error: type int[] is not an expression
testx.d(11): Error: type int[] is not an expression
testx.d(12): Error: type int[] is not an expression
testx.d(8): Error: type char[] is not an expression
testx.d(9): Error: type char[] is not an expression
testx.d(10): Error: type char[] is not an expression
testx.d(11): Error: type char[] is not an expression
testx.d(12): Error: type char[] is not an expression