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

Issue 6100

Summary: [CTFE] regression: struct return values wrong if used in array initializer
Product: D Reporter: Rainer Schuetze <r.sagitario>
Component: dmdAssignee: No Owner <nobody>
Status: RESOLVED FIXED
Severity: regression CC: clugdbug
Priority: P2 Keywords: wrong-code
Version: D2
Hardware: Other
OS: Windows

Description Rainer Schuetze 2011年06月03日 10:34:04 UTC
struct S
{
	int a;
}
S initS(int x)
{
	version(works)
		return S(x);
	else
	{
		S s = S(x);
		return s;
	}
}
static const S[2] s2 = [ initS(1), initS(2) ];
static assert(s2[0].a == 1);
fails with the latest version from github with 
test.d(19): Error: static assert (2 == 1) is false
dmd 2.053 compiles without error. enabling version "works" also works.

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