D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7126 - struct constructor ignored with global initializers
Summary: struct constructor ignored with global initializers
Status: RESOLVED DUPLICATE of issue 7019
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All Linux
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-17 12:58 UTC by siegelords_abode
Modified: 2011-12-17 13:40 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description siegelords_abode 2011-12-17 12:58:30 UTC
struct new_int
{
	this(int val)
	{
		payload = val;
	}
	int payload = -1;
	alias payload this;
}

new_int a = 1; // Error: cannot implicitly convert expression (1) of type int to new_int

void main()
{
	new_int b = 1; // Works ok
}
Comment 1 timon.gehr 2011-12-17 13:40:17 UTC

*** This issue has been marked as a duplicate of issue 7019 ***