# New Ticket Created by   
# Please include the string:  [perl #129256]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=129256 >


How to reproduce:

    perl6 -e 'use NativeCall; CArray[uint8].new(())' 

Fix (not tested):

--- a/lib/NativeCall/Types.pm6
+++ b/lib/NativeCall/Types.pm6
@@ -162,7 +162,7 @@ our class CArray is repr('CArray') is array_type(Pointer) {
     multi method new() { nqp::create(self) }
     multi method new(*@values) { self.new(@values) }
     multi method new(@values) {
-        nextsame unless @values;
+        nextsame unless @values && @values.elems > 0;
         my $result := self.new();
         my int $n = @values.elems;
         my int $i;

Reply via email to