Hi,
I'm having some trouble compiling the following code snippet
#include <algorithm> #define SIZE (1000) struct S { int *vect; }; int main() { struct S* s = (struct S*)(malloc(sizeof(struct S))); s->vect = (int*)(malloc(sizeof(int) * SIZE)); for(int i = 0; i < SIZE; i++) { s->vect[i] = i; } std::sort(s->vect, s->vect + SIZE); }
The compiler returns the following error related to the std::sort call
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.12.25827\include\algorithm(3138): error : access violation 1> return (pair<_RanIt, _RanIt>(_Pfirst, _Plast)); 1> ^
I'm using visual studio enterprise 2017 version 15.5.2 and the intel compiler 64 bit version 17.0.4.210 Build 20170411.
The code used to work before the latest visual studio update.
Thanks in advance.