6331 – [CTFE] Cannot evaluate SliceExp on if condition

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6331 - [CTFE] Cannot evaluate SliceExp on if condition
Summary: [CTFE] Cannot evaluate SliceExp on if condition
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
Reported: 2011年07月15日 23:13 UTC by Kenji Hara
Modified: 2011年07月17日 14:02 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2011年07月15日 23:13:22 UTC
This code should be compiled, but it generate error.
----
bool func(string s)
{
 if (s[0..1])
 return true;
 return false;
}
enum f = func("str");
void main(){}
----
test.d(7): Error: cannot evaluate func("str") at compile time
----
Comment 1 Kenji Hara 2011年07月16日 07:52:51 UTC
https://github.com/D-Programming-Language/dmd/pull/255 


AltStyle によって変換されたページ (->オリジナル) /