[pulse] add example of FN in const-ref-bound temporary

Summary:
This one isn't caught because we don't destruct temporaries that are
bound to a const reference. According to the C++ standard these should
get destroyed when the const reference gets destroyed but instead we
just don't destroy them for now.

Reviewed By: mbouaziz

Differential Revision: D15760209

fbshipit-source-id: 32c935ec0
master
Jules Villard 6 years ago committed by Facebook Github Bot
parent e14809baa8
commit 6f5cb512db

@ -59,4 +59,21 @@ int call_mk_UniquePtr_A_copy_object_ok() {
return a.s_;
}
void temporary_in_conditional_ok() {
while (true) {
int x = true ? 0 : A(4).s_;
}
}
void call_mk_UniquePtr_A_get_field_ok() { int x = A().s_; }
int FN_bind_temporary_to_const_bad() {
A* a_ptr;
{
const UniquePtr<A>& local = mk_UniquePtr_A();
a_ptr = local.get();
}
return a_ptr->s_;
}
} // namespace temporaries

Loading…
Cancel
Save