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
MIT License
35.8k stars 2.17k forks source link

Error initializing DoublyLinkedList with reference type #18367

Closed Yaisis closed 3 months ago

Yaisis commented 1 year ago

Describe the bug

Error initializing DoublyLinkedList with reference type:

mut dl := datatypes.DoublyLinkedList[&User]{} // "C gen error:1"

Expected Behavior

Creating a List of Values

Current Behavior

Error output "C gen error:1"

Reproduction Steps

` module main

import datatypes

[heap] struct User { name string }

fn main() { mut dl := datatypes.DoublyLinkedList[&User]{} // "C gen error:1" println(dl) } `

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.3.4 c06fd55

Environment details (OS name and version, etc.)

OS: linux, "Manjaro Linux"

islonely commented 1 year ago

This is the same issue I reported a while back #14815 Would definitely like to see that pull request accepted. I've been waiting a while lol

Delta456 commented 3 months ago

The above bug is fixed and the program successfully compiles with the correct output.

[]