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

orm: cgen issue when updating embedded structs #23023

Open
Le0Developer opened this issue Nov 30, 2024 · 0 comments
Open

orm: cgen issue when updating embedded structs #23023

Le0Developer opened this issue Nov 30, 2024 · 0 comments
Labels
Bug This tag is applied to issues which reports bugs. ORM Bugs/feature requests, that are related to the V ORM. Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: cgen Bugs/feature requests, that are related to the default C generating backend.

Comments

@Le0Developer
Copy link
Member

Le0Developer commented Nov 30, 2024

V doctor:

V full version: V 0.4.8 602b097
OS: macos, macOS, 15.1.1, 24B2091
Processor: 10 cpus, 64bit, little endian, Apple M4

getwd: /Users/leodev/p/v/fast2
vexe: /Users/leodev/p/v/v/v
vexe mtime: 2024-11-30 11:15:35

vroot: OK, value: /Users/leodev/p/v/v
VMODULES: OK, value: /Users/leodev/.vmodules
VTMP: OK, value: /tmp/v_501

Git version: git version 2.47.0
Git vroot status: weekly.2024.48-24-g602b097d
.git/config present: true

CC version: Apple clang version 16.0.0 (clang-1600.0.26.4)
emcc version: N/A
thirdparty/tcc status: thirdparty-macos-arm64 713692d4

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

import db.sqlite

@[table: 'commits']
struct Commit {
	commit string @[primary]
	thing Thing
}

struct Thing {
	value string
}

db := sqlite.connect(':memory:')!

t := Thing{
	value: 'hello'
}
sql db {
	update Commit set thing = t where commit == ''
}!

What did you expect to see?

Successful compilation

What did you see instead?

================== C compilation error (from cc): ==============
cc:       |               ^
cc: /tmp/v_501/repro.01JDZF4R5N57ZWC02113MPX6AC.tmp.c:19262:6: error: call to undeclared function 'orm__main__Thing_to_primitive'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
cc:  19262 |                                         orm__main__Thing_to_primitive(t),
cc:        |                                         ^
cc: /tmp/v_501/repro.01JDZF4R5N57ZWC02113MPX6AC.tmp.c:19262:6: note: did you mean 'orm__option_string_to_primitive'?
cc: /tmp/v_501/repro.01JDZF4R5N57ZWC02113MPX6AC.tmp.c:18212:32: note: 'orm__option_string_to_primitive' declared here
cc:  18212 | VV_LOCAL_SYMBOL orm__Primitive orm__option_string_to_primitive(_option_string b) {
cc:        |                                ^
cc: /tmp/v_501/repro.01JDZF4R5N57ZWC02113MPX6AC.tmp.c:19262:6: error: incompatible integer to pointer conversion initializing 'orm__InfixType *' (aka 'struct orm__InfixType *') with an expression of type 'int' [-Wint-conversion]
cc:  19262 |                                         orm__main__Thing_to_primitive(t),
cc:        |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc: 2 warnings and 2 errors generated.
... (the original output was 23 lines long, and was truncated to 12 lines)
================================================================
(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 .

Huly®: V_0.6-21464

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.

@Le0Developer Le0Developer added the Bug This tag is applied to issues which reports bugs. label Nov 30, 2024
@felipensp felipensp added Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. ORM Bugs/feature requests, that are related to the V ORM. labels Dec 1, 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. ORM Bugs/feature requests, that are related to the V ORM. Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: cgen Bugs/feature requests, that are related to the default C generating backend.
Projects
None yet
Development

No branches or pull requests

2 participants