Function return type validation by compiler
<p>I read in Thinking in C++ by Bruce Eckel that when a C++ compiler encounters a function it decorates it's name using it's name and arguments. 
For a function, int func(char ch); it would decorate it's name as _func_char It doesn't use the return type.</p>

<p>In that case,
In the below program how does the compiler complain "invalid conversion from int to const char*" when it has not stored the return type during function name decoration? Can anyone please clarify?</p>

<pre><code>#include &lt;iostream&gt;

using namespace std;

int func()
{
    int i = 5;
    return i;
}

int main()
{
    string str = func();
}
</code></pre>
