June 05, 2023
https://issues.dlang.org/show_bug.cgi?id=23967

--- Comment #1 from Franciszek Czekala <home@valentimex.com> ---
However, when you shrink the array a like this: a=a[0..$-1], the subsequent capacity will show as zero, so there is inconsistency here which looks like a bug to me.

Example:
int[] a = new int[10];
// a.length == 10, a.capacity == 11
a = a[0..$-1];
// a.length == 9, a.capacity == 0 (???)

Either capacity represents the total number of elements that an array can hold or it represents the amount of elements that can be appended. As can be seen above it can be either the former or the latter depending on the context which seems definitely wrong.

--