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

cgen error in auto generated str() method of an enum with duplicate enum keys #21911

Closed
spytheman opened this issue Jul 23, 2024 · 0 comments · Fixed by #21920
Closed

cgen error in auto generated str() method of an enum with duplicate enum keys #21911

spytheman opened this issue Jul 23, 2024 · 0 comments · Fixed by #21920
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: Checker Bugs/feature requests, that are related to the type checker. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general.

Comments

@spytheman
Copy link
Member

spytheman commented Jul 23, 2024

V doctor:

V full version: V 0.4.6 a7db095.22df56f
OS: linux, Ubuntu 20.04.6 LTS
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i3-3225 CPU @ 3.30GHz

getwd: /space/v/oo
vexe: /space/v/oo/v
vexe mtime: 2024-07-23 06:24:44

vroot: OK, value: /space/v/oo
VMODULES: OK, value: /home/delian/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.45.2
Git vroot status: weekly.2024.30-2-g22df56fa (1 commit(s) behind V master)
.git/config present: true

CC version: cc (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
thirdparty/tcc status: thirdparty-linux-amd64 a0799a5b

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

const one = 1

enum MyEnum {
	a = one
	b
	c = one
}

$for val in MyEnum.values {
	println('> name: ${val.name} | value: ${val.value}')
}

What did you expect to see?

a checker error, that a and c are duplicates

What did you see instead?

================== C compilation error (from tcc): ==============
cc: /tmp/v_1000/b.01J3F8XFC74K61874J8G3H137K.tmp.c:2172: error: duplicate case value
=================================================================
(You can pass `-cg`, or `-show-c-output` as well, to print all the C error messages).

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.

@spytheman spytheman added Bug This tag is applied to issues which reports bugs. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general. Unit: Checker Bugs/feature requests, that are related to the type checker. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. labels Jul 23, 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: Checker Bugs/feature requests, that are related to the type checker. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant