digitalmars.D.learn - static foreach over constant range in nogc block
- tspike (18/18) Oct 03 2020 I came across an issue recently that I’m a little confused by.
- Timon Gehr (6/27) Oct 03 2020 It's a compiler bug, the same as this one:
- tspike (3/8) Oct 03 2020 Ah, thank you for the quick reply! Do you know if this bug has
- Paul Backus (2/12) Oct 03 2020 https://issues.dlang.org/show_bug.cgi?id=18439
- tspike (2/3) Oct 03 2020 Perfect! Thanks for getting back to me so quickly.
- Paul Backus (4/7) Oct 03 2020 FYI I am not Timon Gehr, the person who originally replied to
- tspike (6/14) Oct 03 2020 Sorry about getting your name wrong, I got a little overzealous
I came across an issue recently that I’m a little confused by. The following program fails to compile under LDC and DMD, though it compiles fine under GDC: nogc: void main() { static foreach(i; 0 .. 4) { pragma(msg, i); } } Both DMD and LDC report the following error if I try to compile it: test.d(7): Error: cannot use operator ~= in nogc delegate test.main.__lambda1 I was just wondering, is this is a compiler bug or is there a reason I'm overlooking preventing this sort of code from compiling?
Oct 03 2020
On 03.10.20 13:18, tspike wrote:I came across an issue recently that I’m a little confused by. The following program fails to compile under LDC and DMD, though it compiles fine under GDC: nogc: void main() { static foreach(i; 0 .. 4) { pragma(msg, i); } } Both DMD and LDC report the following error if I try to compile it: test.d(7): Error: cannot use operator ~= in nogc delegate test.main.__lambda1 I was just wondering, is this is a compiler bug or is there a reason I'm overlooking preventing this sort of code from compiling?It's a compiler bug, the same as this one: nogc: void main(){ static immutable x = { int[] a; a~=1; return a; }(); }
Oct 03 2020
On Saturday, 3 October 2020 at 12:43:01 UTC, Timon Gehr wrote:It's a compiler bug, the same as this one: nogc: void main(){ static immutable x = { int[] a; a~=1; return a; }(); }Ah, thank you for the quick reply! Do you know if this bug has already been reported?
Oct 03 2020
On Saturday, 3 October 2020 at 14:02:08 UTC, tspike wrote:On Saturday, 3 October 2020 at 12:43:01 UTC, Timon Gehr wrote:https://issues.dlang.org/show_bug.cgi?id=18439It's a compiler bug, the same as this one: nogc: void main(){ static immutable x = { int[] a; a~=1; return a; }(); }Ah, thank you for the quick reply! Do you know if this bug has already been reported?
Oct 03 2020
On Saturday, 3 October 2020 at 14:12:21 UTC, Paul Backus wrote:https://issues.dlang.org/show_bug.cgi?id=18439Perfect! Thanks for getting back to me so quickly.
Oct 03 2020
On Saturday, 3 October 2020 at 14:17:45 UTC, tspike wrote:On Saturday, 3 October 2020 at 14:12:21 UTC, Paul Backus wrote:FYI I am not Timon Gehr, the person who originally replied to you, but I was able to find the bug report by searching Bugzilla for "static foreach nogc".https://issues.dlang.org/show_bug.cgi?id=18439Perfect! Thanks for getting back to me so quickly.
Oct 03 2020
On Saturday, 3 October 2020 at 14:19:27 UTC, Paul Backus wrote:On Saturday, 3 October 2020 at 14:17:45 UTC, tspike wrote:Sorry about getting your name wrong, I got a little overzealous when snipping off the quoted part of my post! If I find anything else I think might be a bug I'll have to try searching Bugzilla before I ask about it on the forums. Thanks again for your help, I'm amazed at how fast everyone is to help out here!On Saturday, 3 October 2020 at 14:12:21 UTC, Paul Backus wrote:FYI I am not Timon Gehr, the person who originally replied to you, but I was able to find the bug report by searching Bugzilla for "static foreach nogc".https://issues.dlang.org/show_bug.cgi?id=18439Perfect! Thanks for getting back to me so quickly.
Oct 03 2020