Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 16, 2014 std.bigint.BigInt and const modifier | ||||
---|---|---|---|---|
| ||||
BigInt is a struct == ValueType, suppose i can assign const(BigInt) to BigInt const(BigInt)/const(BigInt) do not compile. Is it a bug or design considerations? test.d ---- import std.stdio; import std.bigint; void foo(BigInt b) { std.stdio.writefln("foo(%s)", b); } void main() { const BigInt b = BigInt("445216415446"); auto b1 = b / b; foo(b); } ---- $ dmd test.d /tmp/test.d(14): Error: 'b' is not of arithmetic type, it is a const(BigInt) /tmp/test.d(14): Error: 'b' is not of arithmetic type, it is a const(BigInt) /tmp/test.d(16): Error: function test.foo (BigInt b) is not callable using argument types (const(BigInt)) |
February 16, 2014 Re: std.bigint.BigInt and const modifier | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ruslan Mullakhmetov | Ruslan Mullakhmetov:
> Is it a bug or design considerations?
It was a const correctness bug, but it's already fixed in recent D compilers.
Bye,
bearophile
|
February 16, 2014 Re: std.bigint.BigInt and const modifier | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Sunday, 16 February 2014 at 20:36:32 UTC, bearophile wrote: > Ruslan Mullakhmetov: > >> Is it a bug or design considerations? > > It was a const correctness bug, but it's already fixed in recent D compilers. > > Bye, > bearophile > recent D compilers. i use v2.064.2. is it outdated ? |
February 16, 2014 Re: std.bigint.BigInt and const modifier | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ruslan Mullakhmetov | Ruslan Mullakhmetov:
> i use v2.064.2. is it outdated ?
It will be fixed in dmd 2.065. It's not yet out but you can use it already if you want to be on the "bleeding edge", it's currently in beta3 and most regressions are fixed, so it's probably better than using dmd 2.064.2.
Bye,
bearophile
|
Copyright © 1999-2021 by the D Language Foundation