digitalmars.D - static foreach nogc
- Exil (20/20) May 29 2019 Am I missing something or should this be able to compile? I don't
- rikki cattermole (1/1) May 29 2019 Bug report please. That shouldn't be happening.
- Jacob Carlborg (7/33) May 30 2019 Looks like there are two issues here:
- Timon Gehr (3/37) May 30 2019 The only issue here is that `@nogc:` applies to all nested functions,
- Jacob Carlborg (5/7) Jun 04 2019 You don't see it has a problem that the compiler mentions "delegate" in
- Timon Gehr (2/10) Jun 05 2019 The problem is that there is an error message at all.
- Dennis (2/3) May 30 2019 It's a known bug: https://issues.dlang.org/show_bug.cgi?id=18439
- Nicholas Wilson (2/5) May 30 2019 Fixed in https://github.com/dlang/dmd/pull/9922
- Timon Gehr (2/9) Jun 05 2019 Disgusting.
Am I missing something or should this be able to compile? I don't know where it is even using ~=, is it used internally for ranges? struct T { nogc: auto opBinary(string op, V)(auto ref const(V) vec) const { // Error: cannot use operator ~= in nogc delegate onlineapp.T.opBinary!("+", T).opBinary.__lambda2 static foreach(i ; 0 .. 1) { } return this; } } void main() { T a, b; T c = a + b; } https://run.dlang.io/is/JDXcJj
May 29 2019
Bug report please. That shouldn't be happening.
May 29 2019
On 2019-05-30 04:56, Exil wrote:Am I missing something or should this be able to compile? I don't know where it is even using ~=, is it used internally for ranges? struct T { nogc: auto opBinary(string op, V)(auto ref const(V) vec) const { // Error: cannot use operator ~= in nogc delegate onlineapp.T.opBinary!("+", T).opBinary.__lambda2 static foreach(i ; 0 .. 1) { } return this; } } void main() { T a, b; T c = a + b; } https://run.dlang.io/is/JDXcJjLooks like there are two issues here: 1. That "static foreach" cannot be used in a nogc function 2. That the error message mentions "delegate", which are not in the source code -- /Jacob Carlborg
May 30 2019
On 30.05.19 17:02, Jacob Carlborg wrote:On 2019-05-30 04:56, Exil wrote:The only issue here is that ` nogc:` applies to all nested functions, including delegates that are only used for CTFE.Am I missing something or should this be able to compile? I don't know where it is even using ~=, is it used internally for ranges? struct T { nogc: auto opBinary(string op, V)(auto ref const(V) vec) const { // Error: cannot use operator ~= in nogc delegate onlineapp.T.opBinary!("+", T).opBinary.__lambda2 static foreach(i ; 0 .. 1) { } return this; } } void main() { T a, b; T c = a + b; } https://run.dlang.io/is/JDXcJjLooks like there are two issues here: 1. That "static foreach" cannot be used in a nogc function 2. That the error message mentions "delegate", which are not in the source code
May 30 2019
On 2019-05-30 17:29, Timon Gehr wrote:The only issue here is that ` nogc:` applies to all nested functions, including delegates that are only used for CTFE.You don't see it has a problem that the compiler mentions "delegate" in an error message but "delegate" doesn't exist in the source code? -- /Jacob Carlborg
Jun 04 2019
On 04.06.19 19:58, Jacob Carlborg wrote:On 2019-05-30 17:29, Timon Gehr wrote:The problem is that there is an error message at all.The only issue here is that ` nogc:` applies to all nested functions, including delegates that are only used for CTFE.You don't see it has a problem that the compiler mentions "delegate" in an error message but "delegate" doesn't exist in the source code?
Jun 05 2019
On Thursday, 30 May 2019 at 02:56:16 UTC, Exil wrote:Am I missing something or should this be able to compile?It's a known bug: https://issues.dlang.org/show_bug.cgi?id=18439
May 30 2019
On Thursday, 30 May 2019 at 15:11:31 UTC, Dennis wrote:On Thursday, 30 May 2019 at 02:56:16 UTC, Exil wrote:Fixed in https://github.com/dlang/dmd/pull/9922Am I missing something or should this be able to compile?It's a known bug: https://issues.dlang.org/show_bug.cgi?id=18439
May 30 2019
On 31.05.19 05:40, Nicholas Wilson wrote:On Thursday, 30 May 2019 at 15:11:31 UTC, Dennis wrote:Disgusting.On Thursday, 30 May 2019 at 02:56:16 UTC, Exil wrote:Fixed in https://github.com/dlang/dmd/pull/9922Am I missing something or should this be able to compile?It's a known bug: https://issues.dlang.org/show_bug.cgi?id=18439
Jun 05 2019