7239 – C style struct initialization doesn't work with aliases

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7239 - C style struct initialization doesn't work with aliases
Summary: C style struct initialization doesn't work with aliases
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
Reported: 2012年01月06日 05:40 UTC by Trass3r
Modified: 2015年06月09日 05:11 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 Trass3r 2012年01月06日 05:40:32 UTC
struct vec
{
	float x,y,z,w;
	alias x r;	//! for color access
	alias y g; //! ditto
	alias z b; //! ditto
	alias w a; //! ditto
}
void main()
{
	vec a = {x: 0, g: 0, b: 0, a: 1};
}
test.d(13): Error: vec.g is not a per-instance initializable field
test.d(13): Error: g is not a field of vec
test.d(13): Error: vec.b is not a per-instance initializable field
test.d(13): Error: b is not a field of vec
test.d(13): Error: vec.a is not a per-instance initializable field
test.d(13): Error: a is not a field of vec
Comment 1 Kenji Hara 2012年01月06日 07:13:12 UTC
D2 patch:
https://github.com/D-Programming-Language/dmd/pull/611 


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