[Issue 3557] New: Pure function cannot call struct constructor
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Nov 29 03:19:45 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3557
Summary: Pure function cannot call struct constructor
Product: D
Version: 2.036
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: tomeksowi at gmail.com
--- Comment #0 from Tomasz Sowiński <tomeksowi at gmail.com> 2009-11-29 03:19:44 PST ---
struct A {
float f;
this (float f) {
this.f = f;
}
static pure A stworz(float f) {
return A(f);
}
}
The above doesn't compile:
Error: pure function 'stworz' cannot call impure function 'this'
What's interesting, if stworz signature is one of the below:
static pure stworz(float f);
static pure auto stworz(float f);
then it merrily compiles. So it's sth about the explicit return type.
If I remove the constructor, it also compiles.
If A is a class, it also compiles.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list