Skip to content

cgen: fix bit-field generation for option/result types in minified st…#26670

Merged
JalonSolov merged 2 commits into
vlang:masterfrom
kbkpbot:fix-issue-26622
Mar 1, 2026
Merged

cgen: fix bit-field generation for option/result types in minified st…#26670
JalonSolov merged 2 commits into
vlang:masterfrom
kbkpbot:fix-issue-26622

Conversation

@kbkpbot

@kbkpbot kbkpbot commented Feb 28, 2026

Copy link
Copy Markdown
Contributor

…ructs (fixes #26622)

Option type is represented as structs in C, which cannot be used as bit-fields. Skip the bit-field optimization for this type in minified structs to avoid C compilation errors.

✦ Fix MSVC test failure for minify_option_field test

MSVC handles bit-fields differently than GCC/Clang, causing the minify_option_field test to fail on Windows MSVC CI.

Changes:

  • Added _not_msvc_windows.vv suffix pattern to skip logic in coutput_test.v
  • Renamed test files to use the new suffix: minify_option_field.vvminify_option_field_not_msvc_windows.vv

✦ This follows the existing naming convention (similar to _nix.vv, _msvc_windows.vv, _gcc_windows.vv) for
platform/compiler-specific test handling.

Co-authored-by: iFlow CLI (glm-5)

…ructs (fixes vlang#26622)

Option and result types are represented as structs in C, which cannot be
used as bit-fields. Skip the bit-field optimization for these types in
minified structs to avoid C compilation errors.

Co-authored-by: iFlow CLI <iflow> (glm-5)
MSVC handles bit-fields differently than GCC/Clang, causing the
minify_option_field test to fail on Windows MSVC CI.

- Add _not_msvc_windows.vv suffix pattern to skip logic
- Rename test files to use the new suffix

This follows the existing naming convention for platform/compiler-
specific test handling (similar to _nix.vv, _msvc_windows.vv).
@JalonSolov JalonSolov merged commit 5fe524d into vlang:master Mar 1, 2026
90 checks passed
cestef pushed a commit to cestef/v that referenced this pull request Mar 9, 2026
vlang#26670)

* cgen: fix bit-field generation for option/result types in minified structs (fixes vlang#26622)

Option and result types are represented as structs in C, which cannot be
used as bit-fields. Skip the bit-field optimization for these types in
minified structs to avoid C compilation errors.

Co-authored-by: iFlow CLI <iflow> (glm-5)

* tests: skip minify_option_field test on MSVC

MSVC handles bit-fields differently than GCC/Clang, causing the
minify_option_field test to fail on Windows MSVC CI.

- Add _not_msvc_windows.vv suffix pattern to skip logic
- Rename test files to use the new suffix

This follows the existing naming convention for platform/compiler-
specific test handling (similar to _nix.vv, _msvc_windows.vv).
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 Error: Embedded ? in struct

3 participants