Add a test for #6976

Closes #6976
Add test for #10288

This happened because of the vector with_capacity overflow that was fixed
in #10417.

Fixes #10288
Better error message when using vectors in statics

Closes #10487