Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
May 30, 2019 static foreach @nogc | ||||
---|---|---|---|---|
| ||||
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 30, 2019 Re: static foreach @nogc | ||||
---|---|---|---|---|
| ||||
Posted in reply to Exil | Bug report please. That shouldn't be happening. |
May 30, 2019 Re: static foreach @nogc | ||||
---|---|---|---|---|
| ||||
Posted in reply to Exil | 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/JDXcJj Looks 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 Re: static foreach @nogc | ||||
---|---|---|---|---|
| ||||
Posted in reply to Exil | 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 Re: static foreach @nogc | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On 30.05.19 17:02, Jacob Carlborg wrote:
> 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/JDXcJj
>
> Looks 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
>
The only issue here is that `@nogc:` applies to all nested functions, including delegates that are only used for CTFE.
|
May 31, 2019 Re: static foreach @nogc | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dennis | On Thursday, 30 May 2019 at 15:11:31 UTC, Dennis wrote: > 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 Fixed in https://github.com/dlang/dmd/pull/9922 |
June 04, 2019 Re: static foreach @nogc | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | 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 |
June 06, 2019 Re: static foreach @nogc | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On 04.06.19 19:58, Jacob Carlborg wrote:
> 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?
>
The problem is that there is an error message at all.
|
June 06, 2019 Re: static foreach @nogc | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nicholas Wilson | On 31.05.19 05:40, Nicholas Wilson wrote:
> On Thursday, 30 May 2019 at 15:11:31 UTC, Dennis wrote:
>> 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
>
> Fixed in https://github.com/dlang/dmd/pull/9922
Disgusting.
|
Copyright © 1999-2021 by the D Language Foundation