title: std::reverse_copy "error: function call has aggregate value"
body: <pre><code>#include &lt;vector&gt;
  #include &lt;iostream&gt;
  #include &lt;algorithm&gt;
  #include &lt;iterator&gt;
  using namespace std;
  
  int main()
  {
    int arrA[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    vector&lt;int&gt; vecIntA(arrA, arrA+sizeof(arrA)/sizeof(arrA[0]));
  
    vector&lt;int&gt; vecIntB(vecIntA.size());
  
    //copy((vecIntA.rbegin()+3).base(), (vecIntA.rbegin()+1).base(),  vecIntB.begin()); // OK    
  
    vector&lt;int&gt;::iterator s = (vecIntA.rbegin()+3).base();
    vector&lt;int&gt;::iterator e = (vecIntA.rbegin()+1).base();
    cout &lt;&lt; "s: " &lt;&lt; *s &lt;&lt; ", e: " &lt;&lt; *e &lt;&lt; endl;
    reverse_copy(s, e,  vecIntB.begin()); // error: function call has aggregate value
  
    //copy(vecIntB.begin(), vecIntB.end(), ostream_iterator&lt;int&gt;(cout, ","));
    cout &lt;&lt; endl;
  }
  </code></pre>
  
  <p>Question> how to fix the issue of "error: function call has aggregate value"?</p>
  
  <p>The above code works under VS2010, but not ubuntu12.04 + clang++3.2 or g++4.6.3</p>
  
  <p>Thank you</p>
  
  <p>// Update //</p>
  
  <p>// Reference: <a href="https://stackoverflow.com/questions/5088460/flags-to-enable-thorough-and-verbose-g-warnings">Flags to enable thorough and verbose g++ warnings</a></p>
  
  <pre class="lang-none prettyprint-override"><code>g++ $1.cpp -o $1 -g -O -Wall -Weffc++ -pedantic  \
  -pedantic-errors -Wextra  -Wall -Waggregate-return -Wcast-align \
  -Wcast-qual  -Wchar-subscripts  -Wcomment -Wconversion \
  -Wdisabled-optimization \
  -Werror -Wfloat-equal  -Wformat  -Wformat=2 \
  -Wformat-nonliteral -Wformat-security  \
  -Wformat-y2k \
  -Wimport  -Winit-self  -Winline \
  -Winvalid-pch   \
  -Wunsafe-loop-optimizations  -Wlong-long -Wmissing-braces \
  -Wmissing-field-initializers -Wmissing-format-attribute   \
  -Wmissing-include-dirs -Wmissing-noreturn \
  -Wpacked  -Wpadded -Wparentheses  -Wpointer-arith \
  -Wredundant-decls -Wreturn-type \
  -Wsequence-point  -Wshadow -Wsign-compare  -Wstack-protector \
  -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch  -Wswitch-default \
  -Wswitch-enum -Wtrigraphs  -Wuninitialized \
  -Wunknown-pragmas  -Wunreachable-code -Wunused \
  -Wunused-function  -Wunused-label  -Wunused-parameter \
  -Wunused-value  -Wunused-variable  -Wvariadic-macros \
  -Wvolatile-register-var  -Wwrite-strings \
  -std=c++0x
  </code></pre>