Temporaries in member functions - C++
<p>After putting some code to work, I'm trying to optimize it. One thing that I'm trying to avoid is the creation of temporaries. Given a class</p>

<pre><code>class foo{
   private:
     int a;
   public:
     foo(int sa):a(sa);
     ~foo(){}
    inline int multiply(int b) {return a*b;}//temporary?
};
</code></pre>

<p>The intel compiler is giving me the temporary created/reference temporary used here. Is any temporary variable being created?</p>

<p>EDIT: edited the return type. Also, I <em>think</em> that no temporary variable is being created in multiply, but the intel compiler gives me an error about that.</p>

<p>EDIT 2: After the requests below, here is a FULL code that the intel compiler v. 12 gives the error:</p>

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

 using namespace std;
 const double pi = 3.1415;
 const complex &lt;double&gt; I = (0.0,I);
 const complex &lt;double&gt; oneover2piI = (1.0 / (2.0 * pi * I));

  class foo{
     private:
       complex &lt;double&gt; a;
     public:
       foo(complex &lt;double&gt; sa):a(sa){}
       ~foo(){}
       inline complex &lt;double&gt; multiply(complex&lt;double&gt; b) 
       {return  a*sqrt(b);}
   };
</code></pre>

<p>The compilation line is</p>

<pre><code>  icc -g -O2 -w2 -debug parallel -Wcheck -Weffc++ -mp -fp-stack-check -wd981 -wd2015 -wd1418  test.cpp -o  test
</code></pre>

<p>And the resulting warning is </p>

<pre><code>  test.cpp(7): remark #383: value copied to temporary, reference to temporary used
  const complex &lt;double&gt; oneover2piI = (1.0 / (2.0 * pi * I));
                                         ^
</code></pre>

<p>The question was to <em>understand</em> what the compiler is balking at, and not to be hanous.</p>

<p>Thanks!</p>
