Ambiguous ‘Approx’ when using namespace Catch::Matchers
- Dominant language
- C++
- Stars
- 21.5k
- Forks
- 3.5k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 2
Description
**Describe the bug**
Struggling with error: reference to ‘Approx’ is ambiguous on very simple code:
```
using namespace Catch::Matchers;
uint64_t value = ;
CHECK(value == Catch::Detail::Approx(0));
```
> error: reference to ‘Approx’ is ambiguous
> CHECK(value == Approx(id*1000.));
> 3rdParties/catch.hpp:3082:11: note: candidates are: class Catch::Detail::Approx
> class Approx {
> ^~~~~~
> In file included from tests/TestRest.cpp:12:0:
> 3rdParties/catch.hpp:3758:53: note: template Catch::Matchers::Vector::ApproxMatcher Catch::Matchers::Approx(const std::vector<_Tp, _Alloc>&)
> Vector::ApproxMatcher Approx( std::vector const& comparator ) {
**Expected behavior**
I tried many variations but the only thing that works is removing `using namespace Catch::Matchers`
Is there any other way to get it working?
**Reproduction steps**
Steps to reproduce the bug.
**Platform information:**
- OS: **Ubuntu 18.04**
- Compiler+version: **gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)**
- Catch version: **v2.12.2**
**Additional context**
Compiler flags:
`-std=c++17 -O2 -g -Wall -Werror -D_GNU_SOURCE -fPIC -Wno-sign-compare`
Contributor guide
Assessment
This issue has not been assessed yet.