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 on cast of struct with time.StopWatch to interface. #19497

Closed
islonely opened this issue Oct 3, 2023 · 0 comments · Fixed by #19506
Closed

C error when on cast of struct with time.StopWatch to interface. #19497

islonely opened this issue Oct 3, 2023 · 0 comments · Fixed by #19506
Labels
Bug This tag is applied to issues which reports bugs. Build V build error on any OS/CPU architecture. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Unit: vlib Bugs/feature requests, that are related to the vlib.

Comments

@islonely
Copy link
Contributor

islonely commented Oct 3, 2023

Describe the bug

A C error is generated when you attempt to cast a struct that has a time.StopWatch field to an interface.

Reproduction Steps

import time

interface Cursor {
mut:
	blink time.StopWatch
}

struct LineCursor {
__global:
	blink time.StopWatch = time.new_stopwatch(auto_start: true)
}

fn main() {
	_ := Cursor(LineCursor{})
}

Expected Behavior

Expected code to compile and run with no output.

Current Behavior

C:/Users/imado/AppData/Local/Temp/v_0/test.13346500263690300193.tmp.c:512: warning: WINVER redefined
C:/Users/imado/AppData/Local/Temp/v_0/test.13346500263690300193.tmp.c:7188: warning: implicit declaration of function 'tcc_backtrace'
C:/Users/imado/AppData/Local/Temp/v_0/test.13346500263690300193.tmp.c:14929: warning: assignment from incompatible pointer type
C:/Users/imado/AppData/Local/Temp/v_0/test.13346500263690300193.tmp.c:14935: warning: assignment from incompatible pointer type
C:/Users/imado/AppData/Local/Temp/v_0/test.13346500263690300193.tmp.c:14941: warning: assignment from incompatible pointer type
C:/Users/imado/AppData/Local/Temp/v_0/test.13346500263690300193.tmp.c:14949: warning: assignment from incompatible pointer type
C:/Users/imado/AppData/Local/Temp/v_0/test.13346500263690300193.tmp.c:14975: warning: assignment from incompatible pointer type
C:/Users/imado/AppData/Local/Temp/v_0/test.13346500263690300193.tmp.c:14975: warning: assignment from incompatible pointer type
C:/Users/imado/AppData/Local/Temp/v_0/test.13346500263690300193.tmp.c:14995: warning: assignment from incompatible pointer type
C:/Users/imado/AppData/Local/Temp/v_0/test.13346500263690300193.tmp.c:14997: warning: assignment from incompatible pointer type
C:/Users/imado/AppData/Local/Temp/v_0/test.13346500263690300193.tmp.c:14997: warning: assignment from incompatible pointer type
C:/Users/imado/AppData/Local/Temp/v_0/test.13346500263690300193.tmp.c:15017: warning: assignment from incompatible pointer type
C:/Users/imado/AppData/Local/Temp/v_0/test.13346500263690300193.tmp.c:15188: error: cannot convert 'struct time__StopWatchOptions *' to 'struct time__StopWatchOptions'
builder error: 
==================
C error. This should never happen.

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.2 ae5b4bb.6b79b2a

Environment details (OS name and version, etc.)

V full version: V 0.4.2 ae5b4bb.6b79b2a
OS: windows, Microsoft Windows 11 Pro v22621 64-bit
Processor: 16 cpus, 64bit, little endian,

getwd: C:\Windows\System32
vexe: C:\Users\imado\v\v.exe
vexe mtime: 2023-10-03 14:54:04

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: 0.4.2-22-g6b79b2aa
.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 vote for this issue using the 👍 reaction. More votes increase the issue's priority for developers.

Take into account that only the 👍 reaction counts as a vote.
Only reactions to the issue itself will be counted as votes, not comments.

@islonely islonely added the Bug This tag is applied to issues which reports bugs. label Oct 3, 2023
@ArtemkaKun ArtemkaKun added Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Build V build error on any OS/CPU architecture. Unit: vlib Bugs/feature requests, that are related to the vlib. labels Oct 3, 2023
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. Build V build error on any OS/CPU architecture. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Unit: vlib Bugs/feature requests, that are related to the vlib.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants