Why does this not compile?
Shachar Shemesh
shachar at weka.io
Tue Mar 6 15:12:02 UTC 2018
On 06/03/18 17:00, Simen Kjærås wrote:
> Interestingly, replacing 'const' with 'immutable' on fun gives a
> compilation error: "immutable function 'foo.__unittest_foo_1_0.S.fun'
> cannot access mutable data 'n'".
This just means it is completely and totally broken. Changing the
"const" to "immutable" merely decreases the types that can be passed to
the function. I see no case where it is legitimate for a const
decoration to compile and an immutable one not.
Shachar
More information about the Digitalmars-d
mailing list