boostorg / boostorg/optional

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

Open
#90 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
60
Forks
75
PR merge metrics
No merged PRs in 30d

Description

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

```cpp
template
struct X {};

template
inline int get(X const&) { return 0; }

namespace boost {
struct any_type_in_boost_namespace {};
}

#include

class tag;

int main()
{
get(X{});
}
```

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

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.