VS2015 Update 3 compiles this without errors and without warning. Nevertheless, I got the impression that temporary persons can only be associated with references to constants. Is this a mismatch, or am I not understanding something?
struct Foo {}; Foo Func6() { return Foo(); } TEST(Arguments, NonConstReference) { Foo& bob = Func6(); }
EDIT
The question related to marcinj is the same problem, although this question is not specific to VS2015 and was not located when I typed it.
I tested with / W 4 to find out if I received a warning and did not see it, but check it again. I find it now. When opening project properties to configure parameters, VS2015 has the habit of showing the properties dialog set for a different assembly configuration than the one currently selected, the most useless behavior that has caught me many times (and I'm sure I will continue to do this).
As mentioned in this other question using forbidden language extensions (/ Za), this error is an error, but, unfortunately, is not a suitable solution, since compiling Microsoft's own headers will not compile.
source share