Skip to content

Catch2 standalone header is incompatible with with Catch 3.7.1 #343

@fun4jimmy

Description

@fun4jimmy

I am trying to use FakeIt with Catch2 using vcpkg. When using the most recent version of vcpkg (as of 27/09/2024 with "builtin-baseline": "0affe8710a4a5b26328e909fe1ad7146df39d108") I get version 2.4.0 of FakeIt and version 3.7.1 of Catch.

When compiling a FakeIt::Mock with Visual Studio 2022 17.11.4 I get the following compiler errors:

1>C:\xxx\build\Visual Studio 17 2022\vcpkg_installed\x64-windows\include\fakeit\single_header\catch\fakeit.hpp(1210,39): error C2664: 'void Catch::AssertionHandler::handleMessage(Catch::ResultWas::OfType,std::string &&)': cannot convert argument 2 from 'std::string' to 'std::string &&'
1>(compiling source file 'xxx.cpp')
1>    C:\xxx\build\Visual Studio 17 2022\vcpkg_installed\x64-windows\include\fakeit\single_header\catch\fakeit.hpp(1210,64):
1>    You cannot bind an lvalue to an rvalue reference
1>    C:\xxx\build\Visual Studio 17 2022\vcpkg_installed\x64-windows\include\catch2\internal\catch_assertion_handler.hpp(50,14):
1>    see declaration of 'Catch::AssertionHandler::handleMessage'
1>    C:\xxx\build\Visual Studio 17 2022\vcpkg_installed\x64-windows\include\fakeit\single_header\catch\fakeit.hpp(1210,39):
1>    while trying to match the argument list '(Catch::ResultWas::OfType, std::string)'
1>C:\xxx\build\Visual Studio 17 2022\vcpkg_installed\x64-windows\include\fakeit\single_header\catch\fakeit.hpp(1213,17): error C3861: 'INTERNAL_CATCH_REACT': identifier not found
1>(compiling source file xxx.cpp')
1>C:\xxx\build\Visual Studio 17 2022\vcpkg_installed\x64-windows\include\fakeit\single_header\catch\fakeit.hpp(1214,13): error C2143: syntax error: missing ';' before '}'
1>(compiling source file 'xxx.cpp')

If I roll back the Catch version to 3.7.0 using an override in the vcpkg.json manifest the file compiles successfully.

Catch 3.7.1 removed the INTERNAL_CATCH_REACT define (catchorg/Catch2@b2b7cbd) and changed the signature of AssertionHandler::handleMessage (catchorg/Catch2@412cad5).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions