Due to the (admittedly braindead) std::vector<bool> implementation :
#include <flat_set.hpp>
fc::vector_set<bool>* set_a;
void foo()
{
set_a->find(true);
}
$ clang++ -Wreturn-stack-address wtf.cpp -Ipath/to/flat/include
In file included from wtf.cpp:1:
In file included from /home/jcelerier/score/API/3rdparty/flat/include/flat_set.hpp:8:
/home/jcelerier/score/API/3rdparty/flat/include/impl/flat_impl.hpp:72:42: warning: returning reference to local temporary object
[-Wreturn-stack-address]
reference operator*() const { return *underlying; }
^~~~~~~~~~~
/home/jcelerier/score/API/3rdparty/flat/include/impl/flat_impl.hpp:269:61: note: in instantiation of member function
'fc::impl::flat_iterator<std::_Bit_iterator, fc::impl::dummy_iterator<std::_Bit_iterator>,
std::random_access_iterator_tag>::operator*' requested here
if(it == self()->end() || self()->value_comp()(key, *it))
^
wtf.cpp:7:12: note: in instantiation of member function 'fc::impl::flat_container_base<fc::flat_set<std::vector<bool,
std::allocator<bool> >, std::less<void> >, bool, std::vector<bool, std::allocator<bool> >, std::less<void>, int>::find' requested
here
set_a->find(true);
^
1 warning generated.
(of course in itself a set is quite dumb, but it's a case that can happen, for instance in generic code ; maybe a static_assert should be in place to prevent such cases ?)
Due to the (admittedly braindead)
std::vector<bool>
implementation :(of course in itself a set is quite dumb, but it's a case that can happen, for instance in generic code ; maybe a static_assert should be in place to prevent such cases ?)