Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/function2/function2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ template <typename T, typename = void>
struct address_taker {
template <typename O>
static void* take(O&& obj) {
return std::addressof(obj);
const void *ret = std::addressof(obj);
return const_cast<void*>(ret);
}
static T& restore(void* ptr) {
return *static_cast<T*>(ptr);
Expand Down
4 changes: 2 additions & 2 deletions test/regressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ TEST(regression_tests, unique_non_copyable) {
}

// https://github.com/Naios/function2/issues/21
/*TEST(regression_tests, can_bind_const_view) {
TEST(regression_tests, can_bind_const_view) {
auto const callable = [] { return 5; };

fu2::function_view<int() const> view(callable);

ASSERT_EQ(view(), 5);
}*/
}

// https://github.com/Naios/function2/issues/48
// -Waddress warning generated for non-capturing lambdas on gcc <= 9.2 #48
Expand Down