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
V full version: V 0.4.8 5c65e58.3108820
OS: windows, Microsoft Windows 10 Pro v19045 64-bit
Processor: 10 cpus, 64bit, little endian,
getwd: C:\Users\user\Downloads
vexe: C:\Users\user\Desktop\Code\v\v.exe
vexe mtime: 2024-11-04 16:24:59
vroot: OK, value: C:\Users\user\Desktop\Code\v
VMODULES: OK, value: C:\Users\user\.vmodules
VTMP: OK, value: C:\Users\user\AppData\Local\Temp\v_0
Git version: git version 2.42.0.windows.1
Git vroot status: weekly.2024.45
.git/config present: true
CC version: Error: 'cc' is not recognized as an internal or external command,
operable program or batch file.
thirdparty/tcc status: thirdparty-windows-amd64 b425ac82
What did you do? ./v -g -o vdbg cmd/v && ./vdbg test.v
fnmain() {
arr:= ["hello", "world"]
for {
arr[69] or { break }
}
println("0_o")
}
What did you expect to see?
error: expression evaluated but not used
What did you see instead?
================== C compilation error (from tcc): ==============
cc: C:/Users/user/AppData/Local/Temp/v_0/test.01JBW2ABZYYKVJ60MYXSQFBG1J.tmp.c:7156: warning: implicit declaration of function 'tcc_backtrace'
cc: C:/Users/user/AppData/Local/Temp/v_0/test.01JBW2ABZYYKVJ60MYXSQFBG1J.tmp.c:13762: error: ';' expected (got "}")
... (the original output was 3 lines long, and was truncated to 2 lines)
=================================================================
(You can pass `-cg`, or `-show-c-output` as well, to print all the C error messages).
builder error:
==================
C error found. It should never happen, when compiling pure V code.
This is a V compiler bug, 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 .
Additional information
If another expression or statement is added after the faulty arr[69] or { break } line, the compiler correctly recognizes that the previous expression is unused, however doesn't report the newly inserted one:
fnmain() {
arr:= ["hello", "world"]
for {
arr[69] or { break }
1
}
println("0_o")
}
errors out with
test.v:4:11: error: expression evaluated but not used
2 | arr := ["hello", "world"]
3 | for {
4 | arr[69] or { break }
| ~~~~~~~~~~~~
5 | 1
6 | }
If expressions like arr[69] or { break } are not supposed to be reported as unused, this should probably be considered a cgen error, as the generated C code does not compile.
This will print 0_o, but should be an error:
fnmain(){
arr := ["hello","world"]
for {
arr[69]or{ break }.len}println("0_o")}
V doctor:
What did you do?
./v -g -o vdbg cmd/v && ./vdbg test.v
What did you expect to see?
error: expression evaluated but not used
What did you see instead?
Additional information
If another expression or statement is added after the faulty
arr[69] or { break }
line, the compiler correctly recognizes that the previous expression is unused, however doesn't report the newly inserted one:errors out with
If expressions like
arr[69] or { break }
are not supposed to be reported as unused, this should probably be considered a cgen error, as the generated C code does not compile.This will print
0_o
, but should be an error:Huly®: V_0.6-21207
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.
The text was updated successfully, but these errors were encountered: