Is this a violation of const?
Timon Gehr
timon.gehr at gmx.ch
Sat Jul 30 17:25:19 UTC 2022
On 7/30/22 15:19, Salih Dincer wrote:
> On Saturday, 30 July 2022 at 10:02:50 UTC, Timon Gehr wrote:
>>
>> It's a `const` hole, plain and simple.
>
> This code, which consists of 26 lines, does not compile in DMD 2.087. I
> am getting this error:
>
>> constHole.d(15): Error: mutable method `source.Updater.opCall` is not
>> callable using a `const` object
> constHole.d(15): Consider adding `const` or `inout` to
> source.Updater.opCall
> constHole.d(21): Error: function `source.Updater.opCall(string s)` is
> not callable using argument types `(string*)`
> constHole.d(21): cannot pass argument `&s.s` of type `string*` to
> parameter `string s`
>
> SDB at 79
Exactly. This is my point. This code does not compile, and neither
should the original version, because it's doing basically the same thing.
More information about the Digitalmars-d-learn
mailing list