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

C error when compiling code #21519

Closed
islonely opened this issue May 17, 2024 · 0 comments · Fixed by #21527
Closed

C error when compiling code #21519

islonely opened this issue May 17, 2024 · 0 comments · Fixed by #21527
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.

Comments

@islonely
Copy link
Contributor

islonely commented May 17, 2024

Describe the bug

C error is produced when trying to compile/run the code from this repo with v run client/.

Reproduction Steps

I usually try to narrow down the code to as small as possible before posting a bug here, but I can't seem to figure out where in the V code this is being caused. It has something to do with the anonymous functions in struct MenuItem in client/menu.v. This line is where the C error is produced, but I'm unable to replicate it without the whole repository.

The generated C code causing the issue:

struct main__MenuItem {
	string label;
	main__CheckboxState state;
	anon_fn_ __v_do; // this has 2 underscores: __v_do
};
else if (app->state == (main__GameState__main_menu)) {
	main__Menu_selected(app->menu)._v_do(); // this has 1 underscore: _v_do()
}

Expected Behavior

Expected the code to compile. It used to do so, but I haven't touched it in 9 months, so I guess some update to V has caused it to break.

Current Behavior

==================
C:/Users/imado/AppData/Local/Temp/v_0/client.01HY2AT8E2DCBMRDSNJRXQRD3C.tmp.c:31468: warning: assignment from incompatible pointer type
C:/Users/imado/AppData/Local/Temp/v_0/client.01HY2AT8E2DCBMRDSNJRXQRD3C.tmp.c:31785: error: field not found: _v_do
...
==================
(Use `v -cg` to print the entire error message)

builder error: 
==================

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.5 25777bd.eeaf8d9

Environment details (OS name and version, etc.)

V full version: V 0.4.5 25777bd.eeaf8d9
OS: windows, Microsoft Windows 11 Pro v22621 64-bit
Processor: 16 cpus, 64bit, little endian, 

getwd: C:\Users\imado\Documents\GitHub\shattlebip
vexe: C:\Users\imado\v\v.exe
vexe mtime: 2024-05-17 02:45:52

vroot: OK, value: C:\Users\imado\v
VMODULES: OK, value: C:\Users\imado\.vmodules
VTMP: OK, value: C:\Users\imado\AppData\Local\Temp\v_0

Git version: git version 2.33.1.windows.1
Git vroot status: weekly.2024.20-7-geeaf8d94
.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 e90c2620

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.

@islonely islonely added the Bug This tag is applied to issues which reports bugs. label May 17, 2024
@felipensp felipensp self-assigned this May 18, 2024
@felipensp felipensp added the Unit: cgen Bugs/feature requests, that are related to the default C generating backend. label May 18, 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants