Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got MSVC error C2248 when I use unique_function with boost::callable_traits::is_invocable #193

Open
redboltz opened this issue Oct 8, 2022 · 1 comment

Comments

@redboltz
Copy link

redboltz commented Oct 8, 2022

When I use boost::callable_traits::is_invocable with fu2::unique_function on msvc v19.33 or older, I got C2248 (cannot access private member) error.
When I replace boost::callable_traits::is_invocable with std::is_invocable (since C++17), then the error is disappeared.

#include <function2/function2.hpp>
#include <boost/callable_traits.hpp>
#include <type_traits>

using unique_func_t = fu2::unique_function<void()>;

int main() {
    // no error with std::is_invocable
    static_assert(std::is_invocable<unique_func_t>::value);
    // error C2248 with boost::callable_traits::is_invocable
    static_assert(boost::callable_traits::is_invocable<unique_func_t>::value);
}

Godbolt link: https://godbolt.org/z/vM19nhfv7

At first, I report the issue to function2.
See Naios/function2#54

The issue happens the combination of boost::callable_traits::is_invocable, fu2::unique_function, and msvc v19.33 or older.
It is complecated for me but fortunately, we can reproduce the issue on godbolt.

So I report the issue here too.

@badair
Copy link
Collaborator

badair commented Oct 12, 2022

Thanks for reporting. That's an interesting case I haven't seen before -- looks like it works correctly on GCC and Clang? Unfortunately, I don't have the bandwidth to dig into this right now, but I'll leave this issue open for a rainy day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants