digitalmars.D.learn - pure is as pure does with LLVM compiler
- Ben Cumming (28/29) Jan 13 2014 Hi There,
- Dicebot (4/12) Jan 13 2014 This is the answer. Current LDC is still based on 2.063.2 version
- Ben Cumming (2/6) Jan 13 2014 Thanks! I will recompile the latest version of LDC then...
- Dicebot (2/8) Jan 13 2014 I don't think 2.064 LDC has been released yet
- Ben Cumming (2/3) Jan 13 2014 So I see, thanks.
- David Nadlinger (6/9) Jan 13 2014 The "merge-2.064" branch in Git is stable enough already for most
Hi There, I am playing around CTFE, and I get different compile time behavior with the reference compiler (both 64-bit Linux): DMD64 D Compiler v2.064 and the LLVM compiler: LDC - the LLVM D compiler (37ee99): based on DMD v2.063.2 and LLVM 3.3 The code snippet at the bottom of the post compiles fine with the reference compiler, but with LDC I get the following error:ldc2 example.dexample.d(4): Error: pure function 'append_index' cannot call impure function 'to' 'to' is not pure, however it seems the reference compiler is able to determine that to is effectively pure. If I remove the 'pure' keyword from the definition of 'append_index', the problem is resolved. Is it "reasonable" that ldc gives this error? What is the best practice in this situation (I require the result of such function calls for constructing more complicated strings at compile time). ------------------------------------------------------ import std.conv; string append_index(uint i) pure { return "v_" ~ to!string(i); } void main() { static assert(A.append_index(3)=="v_3"); }
Jan 13 2014
On Monday, 13 January 2014 at 13:37:05 UTC, Ben Cumming wrote:Hi There, I am playing around CTFE, and I get different compile time behavior with the reference compiler (both 64-bit Linux): DMD64 D Compiler v2.064 and the LLVM compiler: LDC - the LLVM D compiler (37ee99): based on DMD v2.063.2 and LLVM 3.3This is the answer. Current LDC is still based on 2.063.2 version of frontend. There have been several tweaks in `std.conv` to make `to` more pure-friendly between those two releases.
Jan 13 2014
On Monday, 13 January 2014 at 13:46:26 UTC, Dicebot wrote:This is the answer. Current LDC is still based on 2.063.2 version of frontend. There have been several tweaks in `std.conv` to make `to` more pure-friendly between those two releases.Thanks! I will recompile the latest version of LDC then...
Jan 13 2014
On Monday, 13 January 2014 at 14:18:49 UTC, Ben Cumming wrote:On Monday, 13 January 2014 at 13:46:26 UTC, Dicebot wrote:I don't think 2.064 LDC has been released yetThis is the answer. Current LDC is still based on 2.063.2 version of frontend. There have been several tweaks in `std.conv` to make `to` more pure-friendly between those two releases.Thanks! I will recompile the latest version of LDC then...
Jan 13 2014
On Monday, 13 January 2014 at 14:32:03 UTC, Dicebot wrote:I don't think 2.064 LDC has been released yetSo I see, thanks.
Jan 13 2014
On Monday, 13 January 2014 at 15:12:21 UTC, Ben Cumming wrote:On Monday, 13 January 2014 at 14:32:03 UTC, Dicebot wrote:The "merge-2.064" branch in Git is stable enough already for most purposes, so if you don't mind building from Git, you can have an LDC version based on 2.064.2 already. We really need to work out a plan to get a release doneā¦ ;) DavidI don't think 2.064 LDC has been released yetSo I see, thanks.
Jan 13 2014