Skip to content

can't compile pass, i try the second condition alone, or in 'if condition', it's ok, but if it is in 'else if condition', not works #23903

Open
@jemuky

Description

@jemuky
V version: V 0.4.9 4cc6f25, press to see full `v doctor` output
V full version V 0.4.9 f4b51d0.4cc6f25
OS windows, Microsoft Windows 10 专业版 19045 64-bit
Processor 16 cpus, 64bit, little endian, AMD Ryzen 7 4700G with Radeon Graphics
Memory 10.06GB/31.36GB
V executable D:\psoft\v\v.exe
V last modified time 2025-03-11 07:01:22
V home dir OK, value: D:\psoft\v
VMODULES OK, value: D:\psoft\v.vmodules
VTMP OK, value: C:\Users\v_dliweili\AppData\Local\Temp\v_0
Current working dir OK, value: D:\space\other\v_test
Git version git version 2.35.1.windows.2
V git status weekly.2025.11-2-g4cc6f254
.git/config present true
cc version N/A
gcc version gcc (x86_64-win32-seh-rev1, Built by MinGW-Builds project) 13.1.0
clang version clang version 15.0.7
msvc version 用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.29.30158 版
tcc version tcc version 0.9.27 (x86_64 Windows)
tcc git status thirdparty-windows-amd64 b425ac82
emcc version N/A
glibc version ldd (cygwin) 3.3.3

What did you do?
./v -g -o vdbg cmd/v && ./vdbg .\src\main.v && D:\space\other\v_test\src\main.exe

module main

// import main2

fn main() {
	// println(main2.fac)

	println(response('asdffsda?'))
}

fn response(hey_bob string) string {
	return if hey_bob.ends_with('?') {
		'Sure.'
	} else if hey_bob.runes().all(fn (c rune) bool {
		return c >= 65 && c <= 90
	}){
		'Whoa, chill out!'
	} else {
		'123'
	}
}

What did you see?

================== C compilation error (from tcc): ==============
cc: C:/Users/v_dliweili/AppData/Local/Temp/v_0/main.01JP209KEEN7C40A6TSXWGF7T1.tmp.c:3773: warning: implicit declaration of function 'tcc_backtrace'
cc: C:/Users/v_dliweili/AppData/Local/Temp/v_0/main.01JP209KEEN7C40A6TSXWGF7T1.tmp.c:5832: error: '_t3' undeclared
...
cc: C:/Users/v_dliweili/AppData/Local/Temp/v_0/main.01JP209KEEN7C40A6TSXWGF7T1.tmp.c:5832: error: '_t3' undeclared
(note: the original output was 3 lines long; it was truncated to its first 2 lines + the last line)
=================================================================
(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 .

What did you expect to see?

compile pass

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

No one assigned

    Labels

    Status: ConfirmedThis bug has been confirmed to be valid by a contributor.Unit: CompilerBugs/feature requests, that are related to the V compiler in general.Unit: cgenBugs/feature requests, that are related to the default C generating backend.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions