initializing global struct with type alias gives c error: struct/union type expected
Closed this issue · 0 comments
daansystems commented
probably related to: #22339
V doctor:
V full version: V 0.4.8 18eee34.9851367
OS: windows, Microsoft Windows 11 Pro v22631 64-bit
Processor: 24 cpus, 64bit, little endian,
getwd: D:\vbug2
vexe: C:\v\v.exe
vexe mtime: 2024-10-03 09:03:37
vroot: OK, value: C:\v
VMODULES: OK, value: C:\Users\info\.vmodules
VTMP: OK, value: C:\Users\info\AppData\Local\Temp\v_0
Git version: git version 2.42.0.windows.2
Git vroot status: 0.4.8-30-g98513672-dirty
.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 b425ac82
What did you do?
./v -g -o vdbg cmd/v && ./vdbg main.v
module main
type Mat4 = [16]f32
pub fn mat4(x0 f32, x1 f32, x2 f32, x3 f32, x4 f32, x5 f32, x6 f32, x7 f32, x8 f32, x9 f32, x10 f32, x11 f32, x12 f32, x13 f32, x14 f32, x15 f32) Mat4 {
return [
x0,
x1,
x2,
x3,
x4,
x5,
x6,
x7,
x8,
x9,
x10,
x11,
x12,
x13,
x14,
x15,
]!
}
pub fn unit_m4() Mat4 {
return mat4(f32(1), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
}
struct GameObject {
mut:
rot Mat4 = unit_m4()
transform Mat4 = unit_m4()
}
__global (
p GameObject
)
fn main() {
println(p)
}
What did you expect to see?
no c error
What did you see instead?
v -enable-globals .
================== C compilation error (from tcc): ==============
cc: C:/Users/info/AppData/Local/Temp/v_0/vbug2.01J991Z0BGPZMHD49755ZFF9MH.tmp.c:7078: warning: implicit declaration of function 'tcc_backtrace'
cc: C:/Users/info/AppData/Local/Temp/v_0/vbug2.01J991Z0BGPZMHD49755ZFF9MH.tmp.c:13583: error: struct/union type expected
... (the original output was 3 lines long, and was truncated to 2 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 .
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.