D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6868 - IsExp + incorrect static array type = error
Summary: IsExp + incorrect static array type = error
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2011-10-30 14:16 UTC by Kenji Hara
Modified: 2011-11-15 00:25 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 2011-10-30 14:16:42 UTC
Code:
----
@property bool empty(T)(in T[] a) @safe pure nothrow
{
    return !a.length;
}

void main()
{
    alias int[] Range;
    static if (is(char[1 + Range.empty]))  // Line 9
        enum bool isInfinite = true;

    char[0] s;  // need
}

Output:
----
test.d(9): Error: Integer constant expression expected instead of cast(uint)(1 + cast(int)empty((__error)))
Comment 1 Kenji Hara 2011-10-30 14:23:36 UTC
Original code:
----
import std.range;
void main()
{
    pragma(msg, isInfinite!(int[]));

    char[0] s;  // need
}
Comment 2 Kenji Hara 2011-10-30 15:04:37 UTC
https://github.com/D-Programming-Language/dmd/pull/482

And change importance: normal -> major
In my opinion, this issue is important, because std.range.isInfinite is used frequently.