Skip to content

Conversation

@pachadotdev
Copy link
Contributor

CXX23 is strict about the lhs operand, which means the current Catch version (1.9.6) used with testthat will cause multiple compilation errors not because of the tested package but because of the vendored Catch header.

This PR shows the scripts I used to use Catch2 with testthat.

I implemented this after noticing that cpp4r does not pass all tests when enforcing CXX23 with the GNU compiler.

@hadley
Copy link
Member

hadley commented Nov 11, 2025

Would you mind explaining what the root problem is and why it needs a ~18K line patch to fix it?

@pachadotdev
Copy link
Contributor Author

Would you mind explaining what the root problem is and why it needs a ~18K line patch to fix it?

yes, sorry the long detail but I am here to explain :)

  1. the current Catch library is severely outdated, I know it works but after going through Catch V1.9 documentation, it is clear that to anticipate to newer C++ standards it is better to use Catch 2
  2. testthat current Catch library is fully vendored, which is 100% ok as long as we do not use testthat with C++23
  3. after doing an almost direct copy and paste of the Catch 2 header, the git diff shows that many lines changed because, as Catch documentation says "we do not tweak the header because it is created after running a pipeline that calls many other files"
  4. after switching to Catch 2, we can use testthat with C++11 <= C++NN <= C++23

I know this PR reads "too forward", but once CRAN starts testing compiled code with C++23, this issue will show up. The current Catch 1.9 that testthat uses works perfectly well with <= C++20

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

Successfully merging this pull request may close these issues.

2 participants