Skip to content

Conversation

@demizer
Copy link
Contributor

@demizer demizer commented Jan 25, 2026

Fix invalid C cast when or-block returns a fixed array constant/variable with GCC 15.2.

Fixes #26442

Changes

  • Only use compound literal cast for brace-enclosed initializers (ArrayInit, StructInit), not for constants/variables
  • Add test case for or-block with fixed array constant

Test plan

  • v -cc gcc vlib/v/tests/options/option_fixed_arr_const_test.v passes
  • Verified test fails on master, passes with fix

@demizer demizer changed the title cgen: fix or-block with fixed array constants cgen: fix or-block with fixed array constants with GCC 15.2 Jan 25, 2026
Fix invalid C cast when or-block returns a fixed array constant/variable.
Only use compound literal cast for brace-enclosed initializers.
@demizer demizer force-pushed the fixed-array-or-block-issue branch from b53a766 to f7b0357 Compare January 26, 2026 06:16
Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

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

Thank you @demizer 🙇🏻 .
Excellent work.

@spytheman spytheman merged commit 7b20c9c into vlang:master Jan 26, 2026
90 checks passed
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.

cgen: invalid C cast to array type when or-block returns fixed array constant

2 participants