Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17063

Runtime crash with non-ref copy constructor

$
0
0

Hi, one of my users encountered a crash and I managed to size it down into a very small reproducable script:

class Foo
{
	Foo(){}
	Foo(Foo f){}
}
void Test(Foo f){}

void Main()
{
	auto f = Foo();
	Test(f);
}

Seems like it's due to the constructor passing by value. If I do “const Foo &in f” it doesn't crash.

I mean, this crashing makes a lot of sense if you think about it 🙂 but perhaps it should throw a compiler error instead?


Viewing all articles
Browse latest Browse all 17063

Trending Articles



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