chapel icon indicating copy to clipboard operation
chapel copied to clipboard

[Bug]: Cannot create a constant task private class

Open jabraham17 opened this issue 4 months ago • 0 comments

I found I cannot have a const task private variable that is a managed class (i.e. the destructor is invoked for me)

class C { }

forall 1..10 with (const c = new C()) { } // error: const actual is passed to 'ref' formal 'x' of chpl__autoDestroy()

However, I can make a var task private class and I can make a const task private record

class C { }
record R { }

forall 1..10 with (var c = new C()) { } // this is fine
forall 1..10 with (const r = new R()) { } // this is also fine

I think this should be valid code, I see no reason a const task private class should not be allowed while a const task private record is.

jabraham17 avatar Sep 27 '24 23:09 jabraham17