Comments (6)
I have a fork that demonstrates the problem with GitHub Actions: https://github.com/alexhultman-2fa/any_invocable
g++ -std=c++17 -Wall -Wextra -Wpedantic main.cpp
shell: /bin/bash -e {0}
In file included from main.cpp:1:
In file included from ./include/ofats/invocable.h:4:
In file included from /Applications/Xcode_12.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:501:
/Applications/Xcode_12.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:2814:40: error: no member named 'value' in 'std::__1::is_constructible<ofats::any_invocable<void ()>, const ofats::any_invocable<void ()> &>'
= is_constructible<_Tp, _Args...>::value;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
./include/ofats/invocable.h:321:1: note: in instantiation of variable template specialization 'std::__1::is_constructible_v<ofats::any_invocable<void ()>, const ofats::any_invocable<void ()> &>' requested here
__OFATS_ANY_INVOCABLE(, , false, &); // 000
^
./include/ofats/invocable.h:265:24: note: expanded from macro '__OFATS_ANY_INVOCABLE'
std::is_constructible_v<FDec, F> && \
^
./include/ofats/invocable.h:321:1: note: in instantiation of default argument for 'any_invocable<const ofats::any_invocable<void ()> &, ofats::any_invocable<void ()> >' required here
__OFATS_ANY_INVOCABLE(, , false, &); // 000
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/ofats/invocable.h:270:5: note: expanded from macro '__OFATS_ANY_INVOCABLE'
any_invocable(F&& f) { \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode_12.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:2803:38: note: while substituting deduced template arguments into function template 'any_invocable' [with F = const ofats::any_invocable<void ()> &, FDec = (no value), $2 = (no value)]
: public integral_constant<bool, __is_constructible(_Tp, _Args...)>
^
/Applications/Xcode_12.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:2858:14: note: in instantiation of template class 'std::__1::is_constructible<ofats::any_invocable<void ()>, const ofats::any_invocable<void ()> &>' requested here
: public is_constructible<_Tp,
^
/Applications/Xcode_12.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/utility:262:51: note: in instantiation of template class 'std::__1::is_copy_constructible<ofats::any_invocable<void ()> >' requested here
!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value,
^
/Applications/Xcode_12.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1733:25: note: while substituting deduced template arguments into function template 'move_if_noexcept' [with _Tp = ofats::any_invocable<void ()>]
_VSTD::move_if_noexcept(*--__end1)
^
/Applications/Xcode_12.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:840:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_ABI_NAMESPACE
^
/Applications/Xcode_12.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:952:21: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<ofats::any_invocable<void ()> > >::__construct_backward_with_exception_guarantees<ofats::any_invocable<void ()> *>' requested here
__alloc_traits::__construct_backward_with_exception_guarantees(
^
/Applications/Xcode_12.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:1668:5: note: in instantiation of member function 'std::__1::vector<ofats::any_invocable<void ()>, std::__1::allocator<ofats::any_invocable<void ()> > >::__swap_out_circular_buffer' requested here
__swap_out_circular_buffer(__v);
^
/Applications/Xcode_12.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:1686:9: note: in instantiation of function template specialization 'std::__1::vector<ofats::any_invocable<void ()>, std::__1::allocator<ofats::any_invocable<void ()> > >::__emplace_back_slow_path<(lambda at main.cpp:10:20)>' requested here
__emplace_back_slow_path(_VSTD::forward<_Args>(__args)...);
^
main.cpp:10:7: note: in instantiation of function template specialization 'std::__1::vector<ofats::any_invocable<void ()>, std::__1::allocator<ofats::any_invocable<void ()> > >::emplace_back<(lambda at main.cpp:10:20)>' requested here
v.emplace_back([]() {
^
1 error generated.
Error: Process completed with exit code 1.
from any_invocable.
Looks like it should compile to me, will take a look shortly.
Sorry for a delay in response.
from any_invocable.
According to last wg21.link/p0288r7 paper, there is additional compile time checks for constructors that should fix the problem.
from any_invocable.
Meaning that this is a bug in the design docs and not in your implementation of said design?
from any_invocable.
@alexhultman yes, looks so. What happens is: macOS clang calls is_constructible for any_invocable somewhere in the guts of vector's emplace_back, which then tries to call the most generic constructor of any_invocable. Since compile-time checks that were proposed in 5th revision aren't strict enough, it calls is_constructible for the same type again while still being in the evaluation chain of previous value, so it's recursive evaluation of unknown value.
I don't want to share more details here, it's pretty common problem that appears when having generic constructors. I will work on the code to be up to date with 7th revision once getting back from vacation.
from any_invocable.
Great! Looking forward to swap over to this implementation once done 👍
from any_invocable.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from any_invocable.