Skip to content

Conversation

@abhishekbelgaonkar23
Copy link
Contributor

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
@ChrisThrasher
Copy link
Collaborator

Could you please remove all the unrelated whitespace changes you made?

@archie2x
Copy link

Just hit this...

Can I submit a fix for the whitespace request?

@ChrisThrasher
Copy link
Collaborator

Just hit this...

Can I submit a fix for the whitespace request?

If you’d like to make a new PR which includes the relevant changes from this PR minus all the unrelated formatting/whitespace changes, I’d appreciate that.

Copy link

@shahsb shahsb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@archie2x
Copy link

Just hit this...
Can I submit a fix for the whitespace request?

If you’d like to make a new PR which includes the relevant changes from this PR minus all the unrelated formatting/whitespace changes, I’d appreciate that.

#2968

@ChrisThrasher
Copy link
Collaborator

Superseded by #2968

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

4 participants