catchorg / catchorg/Catch2

REQUIRE(std::indirect(42) == 42) fails to compile with gcc and clang

Open
#3,073 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
21.5k
Forks
3.5k
Avg merge
3d 16h
Merged PRs (30d)
2

Description

**Describe the bug**
Using Catch2 with `REQUIRE(std::indirect(42) == 42)` triggers a recursive constraint satisfaction error with gcc and clang.

`error: satisfaction of atomic constraint 'requires(const _Tp& __t, const _Up& __u) {__t == __u;} [with _Tp = _Tp; _Up = _Up]' depends on itself`

**Expected behavior**
`REQUIRE(std::indirect(42) == 42)` should compile and pass.

**Reproduction steps**
Build this snippet with x86-64 gcc trunk and -std=c++26
```
#include
#include

TEST_CASE( "std::indirect(42) compares equal to 42" ) {
REQUIRE(std::indirect(42) == 42);
}
```

**Platform information:**
- OS: Compiler Explorer
- Compiler+version: x86-64 gcc trunk and x86-64 clang trunk
- Catch version: Tested with trunk and 3.0.1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.