An Issue I Wish To Raise Awareness On

Dukc via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 19 07:56:58 PDT 2017


On Tuesday, 18 July 2017 at 11:47:37 UTC, Petar Kirov 
[ZombineDev] wrote:
> I think Atila was talking about this one:
> struct A
> {
> 	~this() {}
> }
>
> void main()
> {
> 	auto a = A();
> 	shared b = A();
> }
>

Shouldn't it be :
struct A
{
     ~this() shared {}
}

void main()
{
     auto a = A();
     shared b = A();
}
?

Because handling theard-local data as shared is safe as far as I 
remember, but not the other way round.

And if you want a destructor which works with both immutable and 
normal, shouldn't it be a const destructor?


More information about the Digitalmars-d mailing list