Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with clang, tuple and c++23 #2923

Open
mattgodbolt opened this issue Oct 18, 2024 · 2 comments
Open

Issue with clang, tuple and c++23 #2923

mattgodbolt opened this issue Oct 18, 2024 · 2 comments

Comments

@mattgodbolt
Copy link
Contributor

mattgodbolt commented Oct 18, 2024

Describe the bug

CHECK()-ing tuples on clang (using GCC's stdlib) gives a compile error when compiled with -std=c++23

#include <catch2/catch_test_macros.hpp>
#include <tuple>

using namespace std::literals;

TEST_CASE("tuples") {
    std::tuple<int, int> bob;
    CHECK(bob == std::make_tuple(4, 2));
}

Compiler error is:

error: implicit instantiation of undefined template 'std::tuple_size<Catch::Decomposer>'

Demo: https://compiler-explorer.com/z/hce5jxYWc

Expected behavior
It should compile.

Reproduction steps

As above, using clang with -std=c++23 , but -std=c++20 is OK

Platform information:
Catch version: 3.7.* and onward

Additional context
Entirely possible this is a clang/gcc interop bug. But I figured I'd file here in case someone goes "Oh! I know what that is..."

@mattgodbolt
Copy link
Contributor Author

A disgusting workaround is:

namespace std {
template<> struct tuple_size<Catch::Decomposer> { static constexpr size_t value = 1; };
}

@horenmar
Copy link
Member

So, GCC + libstdc++ works, Clang + libc++ works, Clang + libstdc++ does not.

I am going to call this a third party bug for now, it would not be the first time there was breakage from mixing Clang and libstdc++ in specific version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants