[ create a new paste ] login | about

Link: http://codepad.org/ibTVTcOv    [ raw code | fork ]

C++, pasted on Oct 13:
/*****
test.h
*****/
	#ifndef HEADER_TEST
	#define HEADER_TEST

	#include <list>
	using namespace std;

	void FunctionA(list<int> *src_lstList);

	#endif


/*****
test.lib
Runtime: Multi-threaded DLL
*****/
	/*****
	test.cpp
	*****/
		#include "test.h"
		
		void FunctionA(list<int> *src_lstList)
		{
			list<int>	*lstList = src_lstList;
			
			// If this line is removed, the error does not happen.
			if (1 == 0) lstList->begin();
		}


/*****
test.exe
Runtime: Multi-threaded Debug DLL
Links with test.lib
*****/
	/*****
	main.cpp
	*****/
		#include "test.h"
		
		int main(int argc, char *argv[])
		{
			list<int>	*lstList = new list<int>;
			
			FunctionA(lstList);
			
			list<int> *lstList2 = new list<int>;
			
			// This is the line that errors.  The error is:
			// First-chance exception at 0x00401023 in test.exe: 0xC0000005: Access violation reading location 0xcdcdcdcd.
			list<int>::iterator i = lstList2->begin();
			
			return (0);
		}


Create a new paste based on this one


Comments: