say I have a class:
class A
{
public:
A() {}
};
and a function:
void x(const A & s) {}
and I do:
x(A());
could someone please explain to me the rules regarding passing temporary objects by reference? In terms of what the compiler allows, where you need const, if an implicit copy happens, etc. From playing around, it seems like you need the const which makes sense, but is there a formal rule regarding all this?
Thanks!