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.