Suppose we have an hpp and cpp files with declaration and implementation of the same function with same name/parameters but different return types. The cpp omit to include the hpp. So compiler is ok and linker doesn't raise any error.

hpp declare function as follow: 

```
std::string myFunction(int *);

```

cpp omit to include hpp and implement the function but with different return type:

```
const std::string& myFunction(int *address) {...}

```

Then when client code include the hpp and use the function, and the code is executed, the value of address received by the function is not the one that was sent and I get a SEGFAULT. Indeed debugging I get a different value for address parameter than what I sent.

I understand that an error was made as this code is obviously incorrect: I shall have used the same return type and to help the compiler warn me that the return type were actually different.

Still I'd like to understand what made this issue at runtime ? To me this is something related to the expected position of the arguments in the stack or something like that. But a formal explanation would be interesting for better understanding how C++ works.