Invalid parameter passed in assignment operator?

Hello, When this code executes it is throwing an error stating "An invalid parameter was passed to a function that considers invalid parameters fatal." What could be causing this? In the debugger it breaks at the closing curly brace so everything within the function should have executed successfully. Any Ideas?

1
2
3
4
5
6
7
8
Chunk Chunk:: operator =(const Chunk ch) {
	//Chunk tmp;
	points = ch.points;
	tileMap = ch.tileMap;
	chunkX = ch.chunkX;
	chunkY = ch.chunkY;
	return *this;
}
There may be two things that happen at the closing curly brace. For sure, the argument that was passed in by value is destroyed. And, depending on how the compiler handles it, a copy of *this may be constructed.

Googling brings up this, if you're using tasks:
https://blogs.msdn.microsoft.com/win8devsupport/2012/10/25/how-to-debug-a-task-exception-in-windows-store-application/

From some of the other results googled, I suspect the exception will be triggered by the destructor although the cause is likely to be tied up in the tasks somewhere.

This is a semantically surprising signature for an operator= overload.
I noticed that I had not written a destructor for the chunk class, so I made a blank destructor quickly. Now I am still getting the same error, but it is on the closing brace of the chunk destructor. Why is the error moving around?
> "An invalid parameter was passed to a function that considers invalid
> parameters fatal."
what a useless meaningful message.


> I noticed that I had not written a destructor
¿do you even need one?
http://en.cppreference.com/w/cpp/language/rule_of_three (read «Rule of zero»)


> Any Ideas?
backtrace.
provide a minimal snip that does reproduce your problem.
I narrowed it down to this piece of SFML code:
 
points[((a + b*width) * 4) - 1].texCoords = sf::Vector2f(33, 33);


But I am passing in the exact argument it asks for! (Vector2f) So why is it an invalid parameter?
Why is the error moving around?

It's not. Those two places are conceptually the same, it's just that in one the destructor is implicit so there is no definition to jump to and in the other the destructor is explicit so there is a definition to jump to.


I narrowed it down to this piece of SFML code:

What steps did you take to "narrow it down" to that code?
> But I am passing in the exact argument it asks for! (Vector2f)
failing to provide the correct type would cause a compile-time error.
you said that the error you were getting was a run-time error. For example, it may be caused by a null pointer or one that doesn't point to dynamically allocated memory.


> I narrowed it down to this piece of SFML code:
http://www.eelis.net/iso-c++/testcase.xhtml
Topic archived. No new replies allowed.