D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 9562 - Built-in runtime properties should become error with `Type.prop`
Summary: Built-in runtime properties should become error with `Type.prop`
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 minor
Assignee: No Owner
URL:
Keywords: accepts-invalid, diagnostic, pull
Depends on:
Blocks:
 
Reported: 2013-02-21 18:40 UTC by Kenji Hara
Modified: 2013-11-23 18:38 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2013-02-21 18:40:42 UTC
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 yebblies 2013-11-16 21:46:05 UTC
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
Comment 2 yebblies 2013-11-16 22:03:32 UTC
Whoops, forgot to use -o-

https://github.com/D-Programming-Language/dmd/pull/2791
Comment 3 github-bugzilla 2013-11-23 10:38:23 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ea886613dc5ba9c638b524ae89d32073753a0bfa
Fix Issue 9562 - Built-in runtime properties should become error with `Type.prop`

https://github.com/D-Programming-Language/dmd/commit/5cae978da230222f54e67f4690d6b246685fd9f1
Merge pull request #2791 from yebblies/issue9562

Issue 9562 - Built-in runtime properties should become error with `Type.prop`