v icon indicating copy to clipboard operation
v copied to clipboard

cgen error: could not generate string method `pthread_mutex_t_str` for type `pthread_mutex_t`

Open shove70 opened this issue 2 years ago • 6 comments

OS: macos, macOS, 12.5.1, 21G83 Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz CC version: Apple clang version 13.1.6 (clang-1316.0.21.2.5)

getwd: /Users/shove/Projects/Temp/v/v_test_001 vmodules: /Users/shove/.vmodules vroot: /usr/local/v vexe: /usr/local/v/v vexe mtime: 2022-08-22 01:03:21 is vroot writable: true is vmodules writable: true V full version: V 0.3.0 0d9ac1f

Git version: git version 2.32.1 (Apple Git-133) Git vroot status: weekly.2022.33-46-g0d9ac1f5 .git/config present: true thirdparty/tcc status: thirdparty-macos-amd64 46662e20

What did you do?

import sync

struct Foo {
	mutex &sync.Mutex
}

// fn (f &Foo) str() string {
// 	return 'Foo'
// }

fn main() {
	foo := Foo{mutex: sync.new_mutex()}
	println(foo)
}

What did you expect to see?

What did you see instead?

cgen error: could not generate string method `pthread_mutex_t_str` for type `pthread_mutex_t`

shove70 avatar Aug 22 '22 04:08 shove70

With the latest V commit, the above code compiles and gives the output:

Foo{
    mutex: &sync.Mutex{
        mutex: pthread_mutex_t{}
    }
}

Delta456 avatar Sep 21 '22 04:09 Delta456

on macOS, The problem still exists. on Linux , OK

shove70 avatar Sep 21 '22 04:09 shove70

What is the issue with MacOs?

Delta456 avatar Sep 21 '22 05:09 Delta456

What is the issue with MacOs?

cgen error: could not generate string method pthread_mutex_t_str for type pthread_mutex_t

shove70 avatar Sep 21 '22 05:09 shove70

Strange as it works on Linux for me

Delta456 avatar Sep 21 '22 05:09 Delta456

image

Yes, it's OK on Linux

shove70 avatar Sep 21 '22 05:09 shove70