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

Can't deduce return of operator auto when the result involves a template #199

Open
correaa opened this issue Jan 17, 2024 · 0 comments
Open

Comments

@correaa
Copy link

correaa commented Jan 17, 2024

The compiler can't deduce return of operator auto() when the result is a template:

#include <vector>

template<class T>
struct A {
    std::vector<T> v;
    operator auto() const {return v;}
    // operator std::vector<T>() const {return v;}
};

int main() {
    A<double> a;
    std::vector<double> d = a;
}

https://godbolt.org/z/77Mr95ffv

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

1 participant