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

error C2672: 'operator __surrogate_func': no matching overloaded function found #1

Open
VzdornovNA88 opened this issue Dec 9, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@VzdornovNA88
Copy link

VzdornovNA88 commented Dec 9, 2020

example.cpp

(166): error C2672: 'operator __surrogate_func': no matching overloaded function found (199): note: see reference to function template instantiation 'bool print_foo(const T &)' being compiled with [ T=otherlib::one ] (166): error C2893: Failed to specialize function template 'unknown-type bfg::tag::operator ()(Args &&...) noexcept() const' (111): note: see declaration of 'bfg::tag::operator ()' (166): note: With the following template arguments: (166): note: 'Args={const T &}' Compiler returned: 2

I tried to use TAG_INVOKE pattern in my project I was implementing myself variant this pattern but it didn't work then I have found your project and I tried to compile example but I got the same error from msvc.

https://godbolt.org/z/jKjxWq - it is your example in godbolt.org , any msvc compiler compiles its with error "error C2672: 'operator __surrogate_func': no matching overloaded function found" but clang and gcc (c++11->17->20) compile well , What is happening , I don't know , What am I doing wrong? What do you think about it ? Thanks.

@VzdornovNA88
Copy link
Author

I solved the problem :
https://developercommunity.visualstudio.com/content/problem/571058/error-c2672-operator-surrogate-func-no-matching-ov.html

on godbolt it works only with msvc v19.28 and compiler option = /std:c++latest

@grafikrobot grafikrobot self-assigned this Dec 11, 2020
@grafikrobot grafikrobot added the bug Something isn't working label Dec 11, 2020
@grafikrobot
Copy link
Member

grafikrobot commented Dec 11, 2020

It looks like a bug, as the intent is to have this work on at least vs2017 without the /std:c++latest option. I'll investigate. Thanks for the report.

@VzdornovNA88
Copy link
Author

Like I understood it just Msvc can't deduce the return value type in this case however in simple case such as auto f() - >decltype (h()) { return h() ;} then he can and another example if I set concrete return type for tag invoke instead of deduction type it works then. Sorry for my English.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants