v icon indicating copy to clipboard operation
v copied to clipboard

clang build generic issue

Open StringNick opened this issue 3 years ago • 0 comments

V version: OS:

What did you do? https://devbits.app/play/GsQqm5mK2sn6

module main

struct Test<T> {
    mut:
    	val T
    	tk string
}

struct Test1{
    f fn(Test)
}

fn(t Test<T>) val() T{
    return t.val
}

fn (mut t Test<T>) set_val(val T) {
	t.val = val
} 

fn new_test<T>() &Test<T> {
    return &Test<T>{}
}

fn process<T>(mut t Test<T>) {
    t.set_val('qqq')
    
    anon := fn [t] () {
        println(t)
    }
    anon()
}

fn main() {
    mut t := new_test<string>()
    process(mut t)
   
    println('$t')
}

What did you expect to see? no clang error

What did you see instead? clang error

StringNick avatar Jul 30 '22 16:07 StringNick