As you say, #1 and #3 are fine (though #1 is arguably bad style).

#4 is dodgy for the same reason #2 is; it allows propagating a const reference to a temporary past its lifetime.

Let's check:

#include &lt;iostream&gt;

struct C {
  C() { std::cout &lt;&lt; "C()\n"; }
  ~C() { std::cout &lt;&lt; "~C()\n"; }
  C(const C &amp;) { std::cout &lt;&lt; "C(const C &amp;)\n"; }
};

const C &amp;foo(const C &amp;c) { return c; }

int main() { 
   const C &amp;c = foo(C());
   std::cout &lt;&lt; "c in scope\n";
}


This outputs:

C()
~C()
c in scope


Does this C++ static analysis rule make sense as is?
For some reason the lab seems to have a problem with contamination every so often.  It's virtually impossible to prevent bacteria, viruses, fungi, etc. from getting into the incubator every time you open the door.  Our incubator is pretty old, we don't have one of the new fancier versions that's made with pure copper inside, which effectively kills microorganisms. 

Would it be a good idea to buy a copper plate and place it on the shelf, on which we could put our culture flasks?  Or would it disrupt the flow of heat/CO2 too much?  Would it be better to buy copper foil and wrap the shelves in it, then poke holes into it where all the holes are in the shelf?  

We use good cell culturing practices; I don't contamination is happening because people don't know what they're doing.  It just happens over time with enough people working in a cell culture room.  Could copper in the incubator help?  We probably don't have the money to buy a brand new incubator that's made out of copper, so would this be a viable, economic alternative?
