title: Why cant I post-increment a function call c++
body: <p>Lets say I have this array and function</p>
  <pre><code>int a[] = {1,2};
  
  const int * bar() {
      return a;
  }
  </code></pre>
  <p>Then in main</p>
  <pre><code>int main() {
      const int * p1 = bar()++;
  } 
  </code></pre>
  <p>Why does this throw a compiler error? In my thinking it would return a const int pointer to a and then the post increment operator would move the pointer over to the second element in a.</p>
  <pre><code>test.cpp:14:25: error: lvalue required as increment operand
  
  
  14 |     const int * p1 = bar()++;
  </code></pre>