See http://en.wikipedia.org/wiki/Copy_elision and http://en.wikipedia.org/wiki/Return_value_optimization.
In a sentence, the compiler sees that you will just be copying the value of localA
to a
(in main
), and rather than running a copy operation, it performs an optimization where it just directly writes to a
in the function functionA
.