Skip to content

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

@jogerh

Description

@jogerh

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 <catch2/catch_all.hpp>
#include <memory>

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions