Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot directly create ?int(none) Option #23163

Closed
gechandesu opened this issue Dec 14, 2024 · 0 comments · Fixed by #23167
Closed

Cannot directly create ?int(none) Option #23163

gechandesu opened this issue Dec 14, 2024 · 0 comments · Fixed by #23167
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Unit: markused Bugs/feature requests, that are related to the -skip-unused.

Comments

@gechandesu
Copy link
Contributor

gechandesu commented Dec 14, 2024

V doctor:

V full version: V 0.4.8 5ec9bb5.9e71e32
OS: linux, Linux version 6.6.8-arch1-1 (linux@archlinux) (gcc (GCC) 13.2.1 20230801, GNU ld (GNU Binutils) 2.41.0) #1 SMP PREEMPT_DYNAMIC Thu, 21 Dec 2023 19:01:01 +0000
Processor: 16 cpus, 64bit, little endian, 12th Gen Intel(R) Core(TM) i5-1240P

getwd: /home/ge
vexe: /home/ge/.vlang/v
vexe mtime: 2024-12-14 17:38:37

vroot: OK, value: /home/ge/.vlang
VMODULES: OK, value: /home/ge/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.47.1
Git vroot status: weekly.2024.50-36-g9e71e324
.git/config present: true

CC version: cc (GCC) 14.2.1 20240910
emcc version: N/A
thirdparty/tcc status: thirdparty-linux-amd64 0134e9b9

What did you do?
./v -g -o vdbg cmd/v && ./vdbg create_int_option.vv

fn main() {
	n := ?int(none)
	println(n)
}

What did you expect to see?

Option(none) in output. This is described in docs.

Aliased int works:

type Int = int

fn main() {
	n := ?Int(none)
	println(n)
}
// Option(none)

What did you see instead?

================== C compilation error (from tcc): ==============
cc: /tmp/v_1000/create_int_option.01JF34102EGSCVY1PDBCB8Z2D7.tmp.c:1267: warning: implicit declaration of function 'str_intp'
cc: /tmp/v_1000/create_int_option.01JF34102EGSCVY1PDBCB8Z2D7.tmp.c:1267: error: cannot convert 'int' to 'struct string'
=================================================================
(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 .

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.

Huly®: V_0.6-21600

@felipensp felipensp added Bug This tag is applied to issues which reports bugs. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. labels Dec 14, 2024
@felipensp felipensp self-assigned this Dec 15, 2024
@felipensp felipensp added the Unit: markused Bugs/feature requests, that are related to the -skip-unused. label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Unit: markused Bugs/feature requests, that are related to the -skip-unused.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants