Compiles, but throws bad_alloc()