Naios / continuable

C++14 asynchronous allocation aware futures (supporting then, exception handling, coroutines and connections)
https://naios.github.io/continuable/
MIT License
815 stars 44 forks source link

g++ 9/10 compile error on std::variant<cti::work> #37

Open p4654545 opened 3 years ago

p4654545 commented 3 years ago

@Naios

This concerns g++ 9.3.0 and 10.0.1

Using cti::work within a variant leads to a compiler error in "struct assert_wrong_copy_assign" in function2.hpp.

Using std::is_copy_constructible_v makes the compiler happy.


Commit Hash

Latest

Expected Behavior

No compiler error

Actual Behavior

I get this error from g++-9:

/root/.conan/data/function2/4.1.0///package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/function2/function2.hpp:1398:60: error: incomplete type 'std::is_copy_constructible<cti::promise_base<fu2::abi_400::detail::function<fu2::abi_400::detail::config<true, false, fu2::capacity_fixed<32> >, fu2::abi_400::detail::property<true, false, void() &&, void(cti::exception_arg_t, std::__exception_ptr::exception_ptr) &&> >, cti::detail::identity<> > >' used in nested name specifier 1398 | static_assert(!Config::is_owning || !Config::is_copyable || | ~~~~~~~~~~~^~ 1399 | std::is_copy_constructible<std::decay_t>::value, | ~~~~~~~~~~

Steps to Reproduce

compile with g++-9 or 10 a source file with the following content (could not attach):

#include <continuable/continuable.hpp>
#include <variant>
void foo() { std::variant<cti::work> t; }

Your Environment

p4654545 commented 3 years ago

my code got ruined, another try:

`#include <continuable/continuable.hpp>

include \<variant>

void foo() { std::variant\<cti::work> t; }`

p4654545 commented 3 years ago

reopen

p4654545 commented 3 years ago

It resembles this gcc bug

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90415

p4654545 commented 3 years ago

Would you accept a pull request on function2 which replaces std::is_copy_constructible by std::is_copy_constructible_v in function2.hpp?

Naios commented 3 years ago

function2 is a C++14 lib and std::is_copy_constructible_v is C++17. Probably it is possible to provide a custom is_copy_constructible based on SFINAE when building with GCC for which I would accept a PR.