Closed fredreichbier closed 15 years ago
This code:
Box: class { value: T init: func (v: T) { value = v } } test: func (T: Class) -> T { box := Box new("Hey there!") box value as T } main: func { test(String) println() }
should print "Hey there!", but instead it prints a strange character.
The C code for test looks like this:
test
void test(lang__Pointer __returnArg, lang__Class *T) { lang__String tparam = "Hey there!"; Box *box = Box_new(String_class(), (uint8_t*) &tparam); if (__returnArg) { memcpy(__returnArg, ((lang__Pointer) (&(box->value))), T->size); } return; }
where this line:
memcpy(__returnArg, ((lang__Pointer) (&(box->value))), T->size);
should be:
memcpy(__returnArg, ((lang__Pointer) ((box->value))), T->size);
With this change applied, it works \o/
Fi-fi-fi-fixed. Thanks for reporting, fred. http://github.com/nddrylliog/ooc/commit/c1ff295652dd592417f23b8041817894ba0384dd
This code:
should print "Hey there!", but instead it prints a strange character.
The C code for
test
looks like this:where this line:
should be:
With this change applied, it works \o/