You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I have embedded (with 'HAS', not referenced with 'has') CStruct or
CUnions, and set
the first field in the embedded struct to a 0 (looks like a NULL pointer?)
I get an incorrect error message about the struct being a 'type object'
(undefined)
void fill_foo(foo_t *f, uint64_t a)
{
f->data.a = a;
}
$ gcc -c -Wall -Werror -fpic foo.c
$ gcc -shared -o libfoo.so foo.o
$ perl6 -v
This is Rakudo version 2017.04.3-47-gf0414c4 built on MoarVM version
2017.04-44-gf0db882
implementing Perl 6.c.
$ cat fooperl.pl
use v6;
use NativeCall;
class data is repr('CStruct') {
has uint64 $.a;
}
class foo is repr('CStruct') {
HAS data $.data;
}
sub fill_foo(foo, uint64) is native('foo') {*}
my $foo = foo.new;
fill_foo($foo, 27);
say $foo.data.a; # Works fine, data looks 'defined'
fill_foo($foo, 0);
say $foo.data.a; # Error, data looks 'undefined'?
$ perl6 fooperl.pl
27
Cannot look up attributes in a data type object
in block <unit> at fooperl.pl line 23
dogbert@dogbert-VirtualBox ~ $ perl6 -v
This is Rakudo version 2020.05.1-285-g8134470 built on MoarVM version 2020.05-85-g02c8cf7
implementing Raku 6.d.
dogbert@dogbert-VirtualBox ~ $ perl6 gist.pl6
27
0
Migrated from rt.perl.org#131311 (status was 'new')
Searchable as RT131311$
The text was updated successfully, but these errors were encountered: