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

catch_message.hpp requires interfaces/catch_interfaces_capture.hpp but does not include it #2758

Closed
silabs-MattG opened this issue Nov 2, 2023 · 1 comment
Labels

Comments

@silabs-MattG
Copy link

Describe the bug
Compilation fails when including <catch2/catch_message.hpp> and using the UNSCOPED_INFO macro.

Here is the error message:

[build] .../src/catch2/catch_message.hpp:112:12: error: 'getResultCapture' is not a member of 'Catch'; did you mean 'IResultCapture'?
[build] 112 | Catch::getResultCapture().emplaceUnscopedMessage( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log )
[build] | ^~~~~~~~~~~~~~~~
[build] .../src/catch2/catch_message.hpp:132:32: note: in expansion of macro 'INTERNAL_CATCH_UNSCOPED_INFO'
[build] 132 | #define UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "UNSCOPED_INFO", msg )

Expected behavior
It is expected that catch_message.hpp would include another header, e.g., interfaces/catch_interfaces_capture.hpp, so that the code will compile properly.

Platform information:

  • OS: Windows 10
  • Compiler+version: GCC v13.1.0 (x86_64-posix-seh-rev1, Built by MinGW-Builds project)
  • Catch version: v3.4.0

Additional context
If I don't use UNSCOPED_INFO, there is no compiler error.
The documentation does not specify that there are any other headers to be included for using UNSCOPED_INFO, and this use of interfaces seems to be an internal detail that user would never know.

@horenmar
Copy link
Member

horenmar commented Nov 3, 2023

Interesting. This being issue in a macro, surrogate TUs can't catch this, as the bug doesn't happen until the macro is expanded. And in common usage, the missing include is covered by catch_test_macros.hpp instead.

@horenmar horenmar added the Bug label Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants