What does the standard say about copy/assignment of fundamental types?
For class types, we have copy constructor, assignment operator, which takes the right hand side as a reference (it must be a reference, otherwise we had infinite recursion):
struct Foo {
Foo(const Foo &);
};
How does this defined for fundamental types?
Look at this example:
const Foo foo;
Foo f = foo;
const int a = 2;
int b = a;
Here, f = foo;
odr-uses foo
, as copy-constructor takes a reference, right?. If copy of fundamental types had a reference parameter, then b = a
would odr-use a
as well. Is it the case? If not, how is it handled?