You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Expected Behavior
**V version:** V 0.5.1
**OS:** Void Linux (glibc)
**What did I do?**
Tried to compile a Discord bot using the `discord.v` library (https://github.com/DarpHome/discord.v) after fixing deprecated `json2.raw_decode()` calls to `json2.decode[json2.Any]()`.
**What did I expect to see?**
Successful compilation and a working Discord bot.
**What did I see instead?**
C compilation error from both tcc and clang backends. The V compiler generates invalid C code when compiling generic event waiters in the discord library.
Steps to reproduce:
v install --git https://github.com/DarpHome/discord.v
Fix deprecated json2.raw_decode() → json2.decode[json2.Any]() across all .v files
Create minimal bot:
modulemainimportdiscordfnmain() {
mutbot:= discord.new_bot(discord.BotConfig{
token: 'YOUR_TOKEN'
})!
bot.run()!
}
### Current Behavior```bash/home/lagan/.vmodules/discord/cache.v:191:15: warning: accessing map value that contain pointers requires an `or {}` block outside `unsafe` 189 | } 190 | mut m2 := unsafe { mut m1[id1] } 191 | if id2 !in m1[id1] { | ~~~~~ 192 | if sz := max_size2 { 193 | if m2.len >= sz {================== C compilation error (from tcc): ==============cc: thirdparty/tcc/lib/tcc/include/stdarg.h:8: warning: va_end redefinedcc: /tmp/v_1000/main.01KS538PGMYDWK92AHKGT73F59.tmp.c:94397: error: '{' expected (got ";")...cc: /tmp/v_1000/main.01KS538PGMYDWK92AHKGT73F59.tmp.c:94397: error: '{' expected (got ";")(note: the original output was 17 lines long; it was truncated to its first 2 lines + the last line)=================================================================Try passing `-g` when compiling, to see a .v file:line information, that correlates more with the C error.(Alternatively, pass `-show-c-output`, to print the full C error message).builder error: ==================C error found while compiling generated C code.This can be caused by invalid C interop code, C compiler flags, or a V compiler bug.If your code is pure V and this still happens, please report it using `v bug file.v`,or goto https://github.com/vlang/v/issues/new/choose .You can also use #help on Discord: https://discord.gg/vlang .
Describe the bug
Running
./v -g -o vdbg cmd/v && ./vdbg 'main.v' && 'main'onmain.vproduced a compiler error.Reproduction Steps
Steps to reproduce:
v install --git https://github.com/DarpHome/discord.vsrc/directory issue:mv ~/.vmodules/discord/src/*.v ~/.vmodules/discord/ && rmdir ~/.vmodules/discord/srcjson2.raw_decode()→json2.decode[json2.Any]()across all .v filesPossible Solution
No response
Additional Information/Context
Generated by
v bugfrommain.v.V version
V 0.5.1 b32f9ab
Environment details (OS name and version, etc.)
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.