Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

c++ std::sort intel compiler error : access violation

$
0
0

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.


Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>