div0 wrote:
<snip>
No, that bug is completely different.
None of Lars example code involved assigning to a scope var after it's
declaration. We've discussed this before; allowing assignment to a scope
variable raise questions about which object should actually be deleted.

True, but you stated before that scope on a primitive type does _nothing_ effect, so I was just pointing out that by spec that isn't literally the case.

  struct B { ... }
  scope B b;
Nothing, B's destructor will be called even without scope.

  scope int[] c;
c gets deleted when the scope ends. this applies to classes as well.
<snip>

What gets deleted - the array or the individual objects?

Stewart.

Just the array. There maybe references to those objects elsewhere.
Though if the compiler can do escape analysis and prove all the objects
are dead, then they should be deleted at end of scope as well.

But you might also want to create an array of RAII objects.

At the moment, you can't have an array of a scope class, and if you want an array of RAII objects you have to declare each individually and then put them into the array (meaning there can only be a fixed number of them).

Stewart.

Reply via email to