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

Fix: Clang 19 -Wc++20-extensions warning #2910 #2934

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from

Conversation

abhishekbelgaonkar23
Copy link

Description
This PR fixes an issue where Clang 19 reports a -Wc++20-extensions warning when expanding the TEMPLATE_TEST_CASE macro family. The warning occurs because passing no arguments to the ... parameter of a variadic macro was technically a language extension before C++20, and Clang 19 enforces this more strictly.

The fix introduces a special handling path for Clang 19+ that modifies how template test case macros are expanded, while maintaining the existing behavior for other compilers and older Clang versions. This allows the code to compile without warnings on Clang 19 while preserving full functionality and backward compatibility.

Key changes:

  • Added INTERNAL_CATCH_TEMPLATE_TEST_CASE_HANDLE_EMPTY macro for Clang 19+ specific handling
  • Modified template test case macro expansion path for affected compiler versions
  • Maintains original behavior for other compilers
  • Preserves backward compatibility with existing test cases

Closes #2910

-Added INTERNAL_CATCH_TEMPLATE_TEST_CASE_HANDLE_EMPTY macro for Clang 19+
- Modified template test case macro expansion path for Clang 19+
- Keeps original behavior for other compilers and older Clang versions
…chorg#2910)

- Added INTERNAL_CATCH_TEMPLATE_TEST_CASE_HANDLE_EMPTY macro for Clang 19+
- Modified template test case macro expansion path for Clang 19+
- Keeps original behavior for other compilers and older Clang versions
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.

Clang 19 -Wc++20-extensions warning
1 participant