That's not an "address of int". Loosely defined, address of int would be pointer, that's what goo is returning. It get passed a reference to storage of int type, or speaking in C terms, an int parameter is passed by reference (in C that would mean that a pointer is passed). references are close to pointers but aren't subject to pointer math and have same syntax as a variable.
Function goo() returns a pointer to the parameter passed by reference, essentially it returns pointer to temp in this case. Those are frequent declarators used in combination to type identifier:
- type& var - a reference to type
- type* var - a pointer to type
- type&& var - an rvalue reference to type
Variables of reference type cannot be unitialized and they can be initialized only by lvalue. A reference is evaluated to an lvalue, evaluated to the same storage as the lvalue that was used for initialization.
int b = 222;
int *p = new int(111);
int& refb = b; // evaluated to the storage of b;
int& refp = *p; // evaluated to the storage in dynamic memory, pointed by p;
int& illegal = 2; // ERROR: not a lvalue;
Declarations of rvalue reference is rarely used aside of formal parameter list of overloaded operators, move semantics and template building.