D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.

Issue 6331

Summary: [CTFE] Cannot evaluate SliceExp on if condition
Product: D Reporter: Kenji Hara <k.hara.pg>
Component: dmdAssignee: No Owner <nobody>
Status: RESOLVED FIXED
Severity: normal CC: bugzilla
Priority: P2 Keywords: patch, rejects-valid
Version: D2
Hardware: x86_64
OS: Windows

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 によって変換されたページ (->オリジナル) /