Skip to content

Fix C++26 clang compilation #709

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Lgt2x
Copy link
Member

@Lgt2x Lgt2x commented May 21, 2025

Pull Request Type

  • GitHub Workflow changes
  • Documentation or Wiki changes
  • Build and Dependency changes
  • Runtime changes
    • Render changes
    • Audio changes
    • Input changes
    • Network changes
    • Other changes

Description

Fix compilation for clang when setting C++ standard to 26 (set(CMAKE_CXX_STANDARD 26))

Related Issues

Additions to #686 for clang. #686 only handled GCC compilation

Lgt2x added 2 commits May 21, 2025 23:13
since C++20, 'module' is a reserved keyword
This prevented compilation using clang++ and C++ 26 standard:

error: comparison between two arrays is ill-formed in C++26; to compare array addresses, use unary '+' to decay operands to pointers [-Warray-compare-cxx26]
@@ -68,7 +68,8 @@ void WBSetupFireAnim(object *obj, otype_wb_info *static_wb, int wb_index) {

p_dwb->wb_anim_mask = p_dwb->cur_firing_mask;

if (static_wb->anim_start_frame != static_wb->anim_end_frame) {
// LGT: Awkward array comparison by pointer, needs investivation to understand the actual intent
if (+static_wb->anim_start_frame != static_wb->anim_end_frame) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Because both LHS and RHS are arrays in their own right, the comparison always evaluates to true and should be deleted altogether.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right this test is bogus, I kept it alive to highlight a potential bug that needs to be looked into.

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