If i'm not mistaken, i believe it's actually because you don't use the vector.
Being in release mode you are not permitted to declare variables/methods without actually using them.
That's just... wrong. You're absolutely allowed to have variables and methods that you never use. The compiler is free to remove them (to some degree), but merely having them itself is not an error in any way.
In most languages, at least. In Go, for instance, declaring unused variables is an error. But for C++, you can of course declare placeholder variables which you aren't actually using yet, the compiler will simply ignore them (usually). At least with correct code, adding extra unused variables should not change the program's observable behaviour.
So long as their construction/destruction has no global side-effects.