-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.Status: ConfirmedThis bug has been confirmed to be valid by a contributor.This bug has been confirmed to be valid by a contributor.Unit: cgenBugs/feature requests, that are related to the default C generating backend.Bugs/feature requests, that are related to the default C generating backend.
Description
Describe the bug
Fix: doc_viewer.v C compilation error
Problem
V compiler generates invalid C code when an inline if expression contains a function call
that uses an optional type (?Color). The C ternary can't contain variable declarations.
Reproduction Steps
- checkout commit 9077655 from https://github.com/vlang/gui
- v run examples/doc_viewer.v
Expected Behavior
Should run,
Current Behavior
Produces C Compiler Error
Possible Solution
The description above from Claude Code describes the issue.
Claude worked around the issue in doc_viewer.v in commit fcb25cf by refactoring the inline if expression.
Additional Information/Context
No response
V version
V 0.5.0 8ca3f27
Environment details (OS name and version, etc.)
| V full version | V 0.5.0 e563c8f.8ca3f27 |
|---|---|
| OS | macos, macOS, 26.2, 25C56 |
| Processor | 8 cpus, 64bit, little endian, Apple M2 |
| Memory | 0.16GB/8GB |
| V executable | /Users/mike/Documents/github/v/v |
| V last modified time | 2026-01-30 23:25:00 |
| V home dir | OK, value: /Users/mike/Documents/github/v |
| VMODULES | OK, value: /Users/mike/.vmodules |
| VTMP | OK, value: /tmp/v_501 |
| Current working dir | OK, value: /Users/mike/Documents/github/gui/examples |
| env VFLAGS | "-message-limit 5" |
| env LDFLAGS | "-L/opt/homebrew/opt/ruby/lib" |
| Git version | git version 2.52.0 |
| V git status | 8ca3f27 |
| .git/config present | true |
| cc version | Apple clang version 17.0.0 (clang-1700.6.3.2) |
| gcc version | Apple clang version 17.0.0 (clang-1700.6.3.2) |
| clang version | Apple clang version 17.0.0 (clang-1700.6.3.2) |
| tcc version | tcc version 0.9.28rc 2024-02-05 HEAD@105d70f7 (AArch64 Darwin) |
| tcc git status | thirdparty-macos-arm64 1867108f |
| emcc version | N/A |
| glibc version | N/A |
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
Metadata
Metadata
Assignees
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.Status: ConfirmedThis bug has been confirmed to be valid by a contributor.This bug has been confirmed to be valid by a contributor.Unit: cgenBugs/feature requests, that are related to the default C generating backend.Bugs/feature requests, that are related to the default C generating backend.