http://d.puremagic.com/issues/show_bug.cgi?id=11113
Summary: Weird constructor syntax failure
Product: D
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from [email protected] 2013-09-23 21:30:47 PDT ---
After adding a constructor to a struct in my code, I noticed my {} initializers
were no longer compiling, with a suggestion by the compiler to use ( and )
instead.
Understanding this probably means to use the full constructor prototype, not
just just replace { with (, I decided to just mass replace the { and ( anyway.
The resulting error was actually incredibly strange, and I can't understand the
behavior of DMD in this instance, and therefore assume it is a bug.
Example:
struct Foo {
float a, b;
}
void main() {
Foo[] xs = [(0, 1), (2, 3), (4, 5)];
}
Result:
test.d(6): Error: cannot implicitly convert expression ([1, 3, 5]) of type
int[] to Foo[]
How/why did it reduce (.., x) to x each time?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------