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: regression for Option return of C alias #21493

Closed
ttytm opened this issue May 12, 2024 · 0 comments · Fixed by #21496
Closed

cgen: regression for Option return of C alias #21493

ttytm opened this issue May 12, 2024 · 0 comments · Fixed by #21496
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

@ttytm
Copy link
Member

ttytm commented May 12, 2024

Describe the bug

After #21054 there is a builder error when returning an option that is an alias of a C struct that is not a pointer. It still works with a Result or regular-alias return type.

Workflow that run into it: https://github.com/ttytm/dialog/actions/runs/9044737428

Reproduction Steps

Unfortunately, extracting a self contained example is currently not possible.

For now, I would link a lib that runs into this regression https://github.com/ttytm/dialog
There, build the minimal example (for a repro only the color picker suffices).

Expected Behavior

Works as before.

Current Behavior

gcc

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 .
/tmp/v_1001/minimal.01HXM8YGFNVQ4870R5JFQ311AF.tmp.c: In function ‘indent__option_dialog__Color_str’:
/tmp/v_1001/minimal.01HXM8YGFNVQ4870R5JFQ311AF.tmp.c:3250:48: error: incompatible type for argument 1 of ‘indent_dialog__Color_str’
 3250 |                 res = indent_dialog__Color_str(*(dialog__Color*)it.data, indent_count);
      |                                                ^~~~~~~~~~~~~~~~~~~~~~~~
      |                                                |
      |                                                dialog__Color {aka osdialog_color}
/tmp/v_1001/minimal.01HXM8YGFNVQ4870R5JFQ311AF.tmp.c:284[9](https://github.com/ttytm/dialog/actions/runs/9045105152/job/24854491986#step:5:10):55: note: expected ‘dialog__Color *’ {aka ‘osdialog_color *’} but argument is of type ‘dialog__Color’ {aka ‘osdialog_color’}
 2849 | static string indent_dialog__Color_str(dialog__Color* it, int indent_count); // auto
      |                                        ~~~~~~~~~~~~~~~^~

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.5 35f6523

Environment details (OS name and version, etc.)

all

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.

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