Is this a bug, or is my C++ just rusty?