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

Issue 6985

Summary: [CTFE] Non-constant case expressions can't be interpreted
Product: D Reporter: Don <clugdbug>
Component: dmdAssignee: No Owner <nobody>
Status: RESOLVED FIXED
Severity: normal CC: bugzilla
Priority: P2
Version: D2
Hardware: Other
OS: Windows

Description Don 2011年11月21日 14:43:01 UTC
int bug6985(int z)
{
 int q = z *2 - 6;
 switch(z)
 {
 case q:
 break;
 default:
 }
 return q;
}
static assert(bug6985(4));
test.d(13): called from here: bug6985(4)
test.d(13): Error: static assert (bug6985(4)) is not evaluatable at compile time

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