what's wrong with my class?

Brian Schott via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 4 16:51:03 PDT 2016


On Wednesday, 4 May 2016 at 23:34:52 UTC, Jonathan Villa wrote:
> On Wednesday, 4 May 2016 at 23:33:28 UTC, Brian Schott wrote:
>> On Wednesday, 4 May 2016 at 23:19:08 UTC, Jonathan Villa wrote:
>>> What I'm doing wrong? :<
>>
>> I see that the types of `id_user` aren't necessarily the same 
>> between `create` and `this`.
>
> Oh, they are indeed same (alias). I wrote uint because I didn't 
> want you to confuse with such a large name and I forgot to 
> change the other one c:

import std.conv:emplace;

synchronized class Session
{
	this(uint u)
	{
		this.u = u;
	}
private:
	uint u;
}

void main(string[] args)
{
	ubyte[128] mem;
	Session s = emplace!Session(mem, 10);
}

Looks like the bug is actually with std.conv.emplace. It works if 
you remove "synchronized".



More information about the Digitalmars-d-learn mailing list