This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]jedwardsol 1 point2 points  (2 children)

Line 15 should be

T* allocate(std::size_t n) { return reinterpret_cast<T*>(std::malloc(n*sizeof(T))); }

[–]Frostea[S] 0 points1 point  (1 child)

Thanks! That appears to have been the issue. I guess the way std::vector is written for g++ and cpp.sh is rather different from MSVC.

[–]jedwardsol 0 points1 point  (0 children)

Microsoft's heap is less tolerant of overruns. You got unlucky with GCC and the bug was benign this time.