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

unqualified call to get<T> with a non-boost::optional type should not match #90

Open
Kojoley opened this issue Feb 27, 2021 · 1 comment
Labels

Comments

@Kojoley
Copy link
Contributor

Kojoley commented Feb 27, 2021

boost::get<T>(boost::optional<T> ...) overload matches for a non-boost::optional type when boost namespace is associated with argument's type of unqualified call to get<T>.

template <typename U>
struct X {};

template <typename T, typename U>
inline int get(X<U> const&) { return 0; }

namespace boost {
    struct any_type_in_boost_namespace {};
}

#include <boost/optional.hpp>

class tag;

int main()
{
    get<tag>(X<boost::any_type_in_boost_namespace>{});
}

https://godbolt.org/z/14d476

The example obviously should compile, but instead it tries to instantiate boost::optional<tag> and fails the compilation.

@akrzemi1
Copy link
Member

Thanks for reporting this. I should be able to look at it in a couple of days.

@akrzemi1 akrzemi1 added the bug label Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants