Skip to content

[veb] C compilation error #25215

Description

@Jengro777

Describe the bug

pub struct App {
	veb.Middleware[Context]
        veb.Controller  // error
	veb.StaticHandler  //error
}

When using type aliases in App structures,

 veb.Controller
 veb.StaticHandler

A C error occurred

Reproduction Steps

structs/structs.v

module structs

import veb

pub struct Context {
	veb.Context
}

pub struct App {
	veb.Middleware[Context]
        veb.Controller  // error
	veb.StaticHandler  //error
}

main.v

import veb
import structs

type AliasApp = structs.App
type AliasContext = structs.Context

fn (mut app AliasApp) index(mut ctx AliasContext) veb.Result {
	return ctx.json('success')
}

fn main() {
	port := 9008
	mut app := &AliasApp{}
	veb.run[AliasApp, AliasContext](mut app, port)
}

v run main.v

Expected Behavior

No errors or a friendly "v" error prompt

Current Behavior

Jengro@Jengro-PC:~/Documents/Dev/v-product/vprod-workspase/example/app$ v run main.v
================== C compilation error (from tcc): ==============
cc: /tmp/v_1000/main.01K41RR17CZCAF0GXNJVH7HSHC.tmp.c:19546: error: field not found: controllers
=================================================================
(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 .
Jengro@Jengro-PC:~/Documents/Dev/v-product/vprod-workspase/example/app$

Jengro@Jengro-PC:~/Documents/Dev/v-product/vprod-workspase/example/app$ v run main.v
================== C compilation error (from tcc): ==============
cc: /tmp/v_1000/main.01K41RRRWWE27Q5QCZ85G2H6D6.tmp.c:20313: error: field not found: static_mime_types
=================================================================
(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 .
Jengro@Jengro-PC:~/Documents/Dev/v-product/vprod-workspase/example/app$

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.11 487feb9

Environment details (OS name and version, etc.)

Jengro@Jengro-PC:~/Documents/Dev/v-product/vprod-workspase/example/app$ v doctor

V full version V 0.4.11 d31aaec.487feb9
OS linux, Deepin 25
Processor 6 cpus, 64bit, little endian, Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
Memory 0.44GB/7.6GB
V executable /home/Jengro/.vmr/versions/v_versions/v_latest/v
V last modified time 2025-09-01 00:31:08
V home dir OK, value: /home/Jengro/.vmr/versions/v_versions/v_latest
VMODULES OK, value: /home/Jengro/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/Jengro/Documents/Dev/v-product/vprod-workspase/example/app
Git version git version 2.50.1
V git status weekly.2025.29-270-g487feb9b
.git/config present true
cc version cc (Deepin 12.3.0-17deepin15) 12.3.0
gcc version gcc (Deepin 12.3.0-17deepin15) 12.3.0
clang version Deepin clang version 17.0.6 (5deepin5)
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 (Debian GLIBC 2.38-6deepin16) 2.38
Jengro@Jengro-PC:~/Documents/Dev/v-product/vprod-workspase/example/app$

Metadata

Metadata

Assignees

Labels

BugThis tag is applied to issues which reports bugs.Unit: cgenBugs/feature requests, that are related to the default C generating backend.Unit: vebBugs/feature requests, that are related to the `veb`, V's official web framework.

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions