title: Why is an enum variable an rvalue here?
body: <p>Example:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>typedef enum Color
  {
      RED,
      GREEN,
      BLUE
  } Color;
  
  void func(unsigned int&amp; num)
  {
      num++;
  }
  
  int main()
  {
      Color clr = RED;
      func(clr);
      return 0;
  }
  </code></pre>
  
  <p>I get the following error when I compile this:</p>
  
  <pre><code>&lt;source&gt;: In function 'int main()':
  
  &lt;source&gt;:16:9: error: cannot bind non-const lvalue reference of type 'unsigned int&amp;' to an rvalue of type 'unsigned int'
  
       func(clr);
  
           ^~~
  </code></pre>
  
  <p>I think the variable (<code>clr</code>) I pass to <code>func(unsigned int&amp;)</code> is an lvalue. I can get the address of <code>clr</code> and can assign another value to it. Why does it turn into an rvalue when I try to pass it to <code>func(unsigned int&amp;)</code>?</p>