Skip to content

Compilation error with veb and orm. #25104

Description

@Meeds122

Describe the bug

Only when using veb, inserting an struct which contains another struct into an sqlite table causes a compilation error.

Reproduction Steps

Repo: https://github.com/Meeds122/v_bug_8.12.2025

Expected Behavior

The V program to successfully compile and start a veb server on 8080

Current Behavior

tristan@desktop:~/programming/v_bug_8.12.2025$ v run .
main.v:50:2: warning: unused variable: user_id
48 |
49 | // Compiler Bug
50 | user_id := sql app.db {
| ~~~~~~~
51 | insert new_user into User
52 | } or { panic(error) }
V panic: table.sym: invalid type (typ=ast.Type(0x0 = 0) idx=0). Compiler bug. This should never happen. Please report the bug using v bug file.v.

v hash: db66120
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:19356: at _v_panic: Backtrace
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:36966: by v__ast__default_table_panic_handler
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:36972: by v__ast__Table_panic
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:37671: by v__ast__Table_sym
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:48976: by v__gen__c__Gen_get_table_name_by_struct_type
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:47532: by v__gen__c__Gen_sql_stmt_line
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:47873: by v__gen__c__Gen_write_orm_insert_with_last_ids
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:47731: by v__gen__c__Gen_write_orm_insert
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:47518: by v__gen__c__Gen_sql_insert_expr
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:30246: by v__gen__c__Gen_expr
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:22810: by v__gen__c__Gen_assign_stmt
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:28625: by v__gen__c__Gen_stmt
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:28393: by v__gen__c__Gen_stmts_with_tmp_var
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:28232: by v__gen__c__Gen_stmts
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:39289: by v__gen__c__Gen_gen_fn_decl
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:38826: by v__gen__c__Gen_fn_decl
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:28607: by v__gen__c__Gen_stmt
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:28393: by v__gen__c__Gen_stmts_with_tmp_var
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:28232: by v__gen__c__Gen_stmts
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:27060: by v__gen__c__Gen_gen_file
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:26997: by v__gen__c__cgen_process_one_file_cb
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:33053: by sync__pool__process_in_thread
/tmp/v_1000/v2.01K2KG4WJR55YC2BF83TR09150.tmp.c:15843: by sync__pool__process_in_thread_thread_wrapper
0x73303229caa4: by ???
0x733032329c3c: by ???

Possible Solution

No response

Additional Information/Context

As far as I can tell, both veb and a nested object are required to recreate.

V version

V 0.4.11 db66120

Environment details (OS name and version, etc.)

V full version V 0.4.11 60108cd.db66120
OS linux, Ubuntu 24.04.3 LTS (WSL 2)
Processor 32 cpus, 64bit, little endian, AMD Ryzen 9 7950X 16-Core Processor
Memory 28.11GB/30.92GB
V executable /home/tristan/packages/v/v
V last modified time 2025-08-14 05:16:53
V home dir OK, value: /home/tristan/packages/v
VMODULES OK, value: /home/tristan/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/tristan/programming/v_bug_8.12.2025
Git version git version 2.43.0
V git status db66120
.git/config present true
cc version cc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
gcc version gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
clang version N/A
tcc version tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux)
tcc git status thirdparty-linux-amd64 696c1d84
emcc version N/A
glibc version ldd (Ubuntu GLIBC 2.39-0ubuntu8.5) 2.39

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.

Metadata

Metadata

Assignees

Labels

BugThis tag is applied to issues which reports bugs.ORMBugs/feature requests, that are related to the V ORM.Status: ConfirmedThis bug has been confirmed to be valid by a contributor.

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions