You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Non-namespaced DEPRECATED macro is prone to conflicts #3058
Describe the bug
Macro DEPRECATED needlessly conflicts with other DEPRECATED declaration.
Expected behavior
Macro DEPRECATED is properly namespaced and does not collide with other DEPRECATED declarations.
Reproduction steps
// This would be defined elsewhere, like in a pre-compiled header of a larger program.
#defineDEPRECATED(msg) __declspec(deprecated(msg))
#include"catch_amalgamated.hpp"
Platform information:
Catch v3.12.0, any platform/compiler.
Additional context
IMHO any Catch2 macros that are used by the implementation and not intended to be used inside a test case should be prefixed appropriately. In the case of DEPRECATED, I think it would be better off as CATCH_IMPL_DEPRECATED, as it appears that it is only used in headers and in the implementation.
The reason I'm running into this issue is that I have embedded Catch2 in a larger program, and run its test cases from a debug console. This larger program defines DEPRECATED for itself, and although it's...not great that this program does this, I think that for the specific case of a macro that isn't used when writing tests, it's better to prefix them, as is done in many other places inside the library.
I can work around the compile warning by undefining our DEPRECATED first, but it'd be nice if it was namespaced.
Activity
horenmar commentedon Jan 3, 2026
Yeah, that's a fair complaint; no idea why I didn't prefix the deprecation macro when I introduced it.
Rename DEPRECATED -> CATCH_DEPRECATED