vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creating datatypes.Stack of struct references produces C error.

islonely opened this issue · comments

V doctor:

OS: linux, "Manjaro Linux"
Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
CC version: cc (GCC) 12.1.0

vexe mtime: 2022-06-21 18:28:08
is vroot writable: true
is vmodules writable: true
V full version: V 0.2.4 223b96a.8172fec

Git version: git version 2.36.1
Git vroot status: weekly.2022.24-52-g8172fecb-dirty
.git/config present: true
thirdparty/tcc status: thirdparty-linux-amd64 eee03626

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

import datatypes { Stack }

[heap]
struct Element {
mut:
	name       string
	value      string
}

fn main() {
	mut parent := &Element{
		name: 'parent element'
	}
	mut stack := Stack<&Element>{}
}

What did you expect to see?

Expected stack with generic type of a struct reference to compile

What did you see instead?

test.v:11:6: warning: unused variable: `parent`
    9 | 
   10 | fn main() {
   11 |     mut parent := &Element{
      |         ~~~~~~
   12 |         name: 'parent element'
   13 |     }
test.v:14:6: warning: unused variable: `stack`
   12 |         name: 'parent element'
   13 |     }
   14 |     mut stack := Stack<&Element>{}
      |         ~~~~~
   15 | }
==================
/usr/lib64/crt1.o: error: Invalid relocation entry [15] '.rela.debug_info' @ 000004f5
tcc: error: file 'crt1.o' not found
/tmp/v_1000/test.11332462667088156692.tmp.c:89: error: ';' expected (got "*")
...
==================
(Use `v -cg` to print the entire error message)

builder error: 
==================
C error. This should never happen.

This is a compiler bug, please report it using `v bug file.v`.

https://github.com/vlang/v/issues/new/choose

You can also use #help on Discord: https://discord.gg/vlang

i have same problem.

Try updating V, as for me the code runs just fine.

I have the same problem with the latest version of V just downloaded from github. Just trying to install V triggers the error.

Try performing a clean install, go to your V installation folder, run git pull, & make (or make.bat in Windows)

Try performing a clean install, go to your V installation folder, run git pull, & make (or make.bat in Windows)

That is EXACTLY whay i did before experiencing the bug. Voidlinux, all packages up to date

I am getting the same error with V 0.3.0 74bb5ae.

ezoic increase your site revenue