title: Is the hard coded value in function argument a const reference?
body: <p>Why does the following program fail to compile:</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  int fun(int &amp;x)
  {
      return x;
  }
  int main()
  {
      cout &lt;&lt; fun(10);
      return 0;
  }
  </code></pre>
  
  <p>It gives the following compilation error:
  invalid initialization of non-const reference of type 'int&amp;' from an rvalue of type 'int'</p>
  
  <p>To make it compile successfully , I have 2 options:
  1. we have to use "int fun(const int &amp;x)" instead of "int fun(int &amp;x)"
  2. use "int i=10;cout &lt;&lt; fun(i);" instead of "cout &lt;&lt; func (10)"</p>
  
  <p>So, it seems like , if we pass a hard coded value to a function , it will be treated like "const reference".</p>
  
  <p>Am I right here? or is there any other reason that above program doesn't compile? </p>