template <typename dataTypeA, 
          typename dataTypeB> 
                             dataTypeB const& functionX (dataTypeA argA, 
                                                         dataTypeB const& argB)
{
    return argA;
}
int main ()
{
    cout << functionX (3, 1L);
    return 0;
}
The compilation:
anisha@linux-dopx:~/Desktop/notes/c++> g++ functionTemplates.cpp -Wall -Wextra -pedantic
functionTemplates.cpp: In function ‘const dataTypeB& functionX(dataTypeA, const dataTypeB&) [with dataTypeA = int, dataTypeB = long int]’:
functionTemplates.cpp:47:26:   instantiated from here
functionTemplates.cpp:35:9: warning: returning reference to temporary
and then:
anisha@linux-dopx:~/Desktop/notes/c++> ./a.out
3
Why is it returning 3?
Isn't argA a local variable for that function? Returning its reference shouldn't be successful, isn't it?
 
     
     
    