A new instance of a variable?
Ish via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Nov 13 11:32:59 PST 2015
On Friday, 13 November 2015 at 18:10:38 UTC, Marc Schütz wrote:
> On Friday, 13 November 2015 at 17:44:31 UTC, Ish wrote:
>> On Friday, 13 November 2015 at 16:06:51 UTC, Alex Parrill
>> wrote:
>>> [...]
>>
>> immutable int* j = new immutable int(i);
>> gives error:
>> locks1.d:27: error: no constructor for immutable(int);
>>
>> I need to allocate separate objects as the value is passed to
>> a separate thread as:
>> void incrementer(immutable int* nterm, shared(Lock) lock) {
>> etc. }
>
> This compiles for me with 2.068, 2.069 and latest Git (Linux
> x86_64):
>
> void main() {
> foreach(i; 0 .. 10000) {
> immutable int* j = new immutable int(i);
> }
> }
>
> Can you post more of your actual code?
I am using gdc w/gcc.4.9.2 (backend). So, I should have mentioned
it before making so much noise.
Code provided also does not compile.
More information about the Digitalmars-d-learn
mailing list