Boost logo

Boost :

Subject: [boost] [c++ question] detecting reference to temporaries
From: Raffi Enficiaud (raffi.enficiaud_at_[hidden])
Date: 2018-10-24 22:53:19


I have a stupid question related to a bug in boost.test. A piece of code
is doing something like:

const value& get() {
   return *internal_iterator; // can be a ref or not to value or another
type
}

The fix is trivial, *but* I want to test it.

Is there any technique that would let me test for reference to
temporaries? The only option I see would be to promote compiler warnings
into error, but maybe there is something there?

Thanks,
Raffi

(complete example here:
https://github.com/boostorg/test/blob/90d577a620e008417af79f5caa25e701eef954bc/include/boost/test/data/monomorphic/join.hpp#L60
)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk