6100 – [CTFE] regression: struct return values wrong if used in array initializer

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6100 - [CTFE] regression: struct return values wrong if used in array initializer
Summary: [CTFE] regression: struct return values wrong if used in array initializer
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 regression
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
Reported: 2011年06月03日 10:34 UTC by Rainer Schuetze
Modified: 2011年06月11日 06:44 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 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 によって変換されたページ (->オリジナル) /