Clang 3.9 extremely reuses memory used by temporaries.
This code is UB (simplified code):
template class my_optional { public: bo
You could try out lvalue_ref wrapper from Explicit library. It prevents the unwanted binding to a temporary in one declaration, like:
const T& get_or_default(lvalue_ref def) { return has ? value : def.get(); }