digitalmars.D.learn - cannot call impure function
- Michael (22/22) Oct 04 2020 Dear all,
- Paul Backus (3/11) Oct 04 2020 Works fine for me using DMD 2.094.0 on Linux. What OS and
- Michael (3/18) Oct 04 2020 DMD64 D Compiler v2.094.0
- Michael (3/22) Oct 04 2020 I did not use any compiler flags, but just:
- Mathias LANG (3/22) Oct 04 2020 I cannot reproduce locally (macOS 10.15.6 too). How did you
- Michael (2/25) Oct 04 2020 I used the dmg file: dmd.2.094.0.dmg
- Michael (6/32) Oct 04 2020 I reinstalled using the installation script (install.sh) and now
- Mathias LANG (5/13) Oct 04 2020 I think there might have been a mismatch between the compiler
- Imperatorn (3/7) Oct 04 2020 I have tried my best to make it fail, but can't. Maybe it's
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); } Error message: /Library/D/dmd/src/phobos/std/format.d(1601): Error: pure function 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(1590): instantiated from here: formattedWrite!(LockingTextWriter, char, double) /Library/D/dmd/src/phobos/std/stdio.d(3927): instantiated from here: write!(double, char) test1.d(5): instantiated from here: writeln!double Cheers, Michael
Oct 04 2020
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 Linux. What OS and compiler version are you using, and how did you install DMD?
Oct 04 2020
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:DMD64 D Compiler v2.094.0 on macOS 10.15.6Dear 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 Linux. What OS and compiler version are you using, and how did you install DMD?
Oct 04 2020
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:I did not use any compiler flags, but just: dmd test1.dOn Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote:DMD64 D Compiler v2.094.0 on macOS 10.15.6Dear 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 Linux. What OS and compiler version are you using, and how did you install DMD?
Oct 04 2020
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:I cannot reproduce locally (macOS 10.15.6 too). How did you install DMD ?On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote:DMD64 D Compiler v2.094.0 on macOS 10.15.6Dear 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 Linux. What OS and compiler version are you using, and how did you install DMD?
Oct 04 2020
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:I used the dmg file: dmd.2.094.0.dmgOn Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote:I cannot reproduce locally (macOS 10.15.6 too). How did you install DMD ?On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote:DMD64 D Compiler v2.094.0 on macOS 10.15.6Dear 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 Linux. What OS and compiler version are you using, and how did you install DMD?
Oct 04 2020
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:I reinstalled using the installation script (install.sh) and now it works. Still don't know why the dmg-based intstallation did not work. https://dlang.org/install.html Anyway, thanks for your responses!On Sunday, 4 October 2020 at 17:05:33 UTC, Michael wrote:I used the dmg file: dmd.2.094.0.dmgOn Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote:I cannot reproduce locally (macOS 10.15.6 too). How did you install DMD ?On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote:DMD64 D Compiler v2.094.0 on macOS 10.15.6Dear 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 Linux. What OS and compiler version are you using, and how did you install DMD?
Oct 04 2020
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 think there might have been a mismatch between the compiler used, and the Phobos library used. This might happen if you used multiple sources for installation, e.g. brew / macports / dmg (install script is self contained and never affected).[...] I used the dmg file: dmd.2.094.0.dmgI reinstalled using the installation script (install.sh) and now it works. Still don't know why the dmg-based intstallation did not work. https://dlang.org/install.html Anyway, thanks for your responses!
Oct 04 2020
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 combination of dmd64 and MACOS?
Oct 04 2020