Re: cannot call impure function

2020-10-04 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 4 October 2020 at 18:02:11 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:43:13 UTC, Michael wrote: [...] I used the dmg file: dmd.2.094.0.dmg I reinstalled using the installation script (install.sh) and now it works. Still don't know why the dmg-based intstallation did not w

Re: cannot call impure function

2020-10-04 Thread Michael via Digitalmars-d-learn
On Sunday, 4 October 2020 at 17:43:13 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:37:52 UTC, Mathias LANG wrote: On Sunday, 4 October 2020 at 17:05:33 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote: On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wr

Re: cannot call impure function

2020-10-04 Thread Michael via Digitalmars-d-learn
On Sunday, 4 October 2020 at 17:37:52 UTC, Mathias LANG wrote: On Sunday, 4 October 2020 at 17:05:33 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote: On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid question,

Re: cannot call impure function

2020-10-04 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid question, but I'm a complete newbie to D. Why does compiling the following trivial code fail? [...] I have tried my best to make it fail, but can't. Maybe it's something with the combinatio

Re: cannot call impure function

2020-10-04 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 4 October 2020 at 17:05:33 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote: On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid question, but I'm a complete newbie to D. Why does compiling the followi

Re: cannot call impure function

2020-10-04 Thread Michael via Digitalmars-d-learn
On Sunday, 4 October 2020 at 17:05:33 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote: On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid question, but I'm a complete newbie to D. Why does compiling the followi

Re: cannot call impure function

2020-10-04 Thread Michael via Digitalmars-d-learn
On Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote: On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid question, but I'm a complete newbie to D. Why does compiling the following trivial code fail? import std.stdio; void main() {

Re: cannot call impure function

2020-10-04 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid question, but I'm a complete newbie to D. Why does compiling the following trivial code fail? import std.stdio; void main() { writeln(3.14); } Works fine for me using DMD 2.094.0 on Lin

cannot call impure function

2020-10-04 Thread Michael via Digitalmars-d-learn
ction std.format.FormatSpec!char.FormatSpec.toString cannot call impure function std.format.FormatSpec!char.FormatSpec.toString!(Appender!string).toString /Library/D/dmd/src/phobos/std/format.d(478): Error: template instance std.format.FormatSpec!char error instantiating /Library/D/dmd/src/phobos/std/stdio.d

Re: cannot call impure function ~this

2013-10-17 Thread Namespace
In this case, the created struct literal A() will be moved out to the function getA(). So dtor is not called and compiler should not cause "cannot call impure function" error. I filed a bug report and posted possible compiler fix. http://d.puremagic.com/issues/show_bug.cgi?id=1

Re: cannot call impure function ~this

2013-10-17 Thread Kenji Hara
at 21:37:40 UTC, Namespace wrote: I get this error: /d701/f223.d(11): Error: pure function 'f223.getA' cannot call impure function 'f223.A.~this' with this code: import std.stdio; struct A { public: ~this() { writeln("DTor"

Re: cannot call impure function ~this

2013-10-16 Thread Namespace
/f223.d(11): Error: pure function 'f223.getA' cannot call impure function 'f223.A.~this' with this code: import std.stdio; struct A { public: ~this() { writeln("DTor"); } } A getA() pure nothrow { return A(); } vo

Re: cannot call impure function ~this

2013-10-16 Thread monarch_dodra
On Wednesday, 16 October 2013 at 07:27:25 UTC, Namespace wrote: On Wednesday, 16 October 2013 at 07:23:45 UTC, monarch_dodra wrote: On Tuesday, 15 October 2013 at 21:37:40 UTC, Namespace wrote: I get this error: /d701/f223.d(11): Error: pure function 'f223.getA' cannot c

Re: cannot call impure function ~this

2013-10-16 Thread Namespace
On Wednesday, 16 October 2013 at 07:23:45 UTC, monarch_dodra wrote: On Tuesday, 15 October 2013 at 21:37:40 UTC, Namespace wrote: I get this error: /d701/f223.d(11): Error: pure function 'f223.getA' cannot call impure function 'f223.A.~this' with this code: -

Re: cannot call impure function ~this

2013-10-16 Thread monarch_dodra
On Tuesday, 15 October 2013 at 21:37:40 UTC, Namespace wrote: I get this error: /d701/f223.d(11): Error: pure function 'f223.getA' cannot call impure function 'f223.A.~this' with this code: import std.stdio; struct A { public: ~this() {

cannot call impure function ~this

2013-10-15 Thread Namespace
I get this error: /d701/f223.d(11): Error: pure function 'f223.getA' cannot call impure function 'f223.A.~this' with this code: import std.stdio; struct A { public: ~this() { writeln("DTor"); } } A getA() p