]> Cypherpunks repositories - gostls13.git/commitdiff
make string take []byte only, so have to use *[10]byte to convert
authorRuss Cox <rsc@golang.org>
Fri, 17 Apr 2009 06:07:15 +0000 (23:07 -0700)
committerRuss Cox <rsc@golang.org>
Fri, 17 Apr 2009 06:07:15 +0000 (23:07 -0700)
R=r
DELTA=4  (0 added, 0 deleted, 4 changed)
OCL=27578
CL=27584

test/fixedbugs/bug102.go
test/ken/string.go

index 58480974ba5d82a53bb18df465a8488bf0518cc3..92163baa1c15e542a547f65c9725232598bcb38a 100644 (file)
@@ -8,12 +8,12 @@ package main
 
 func main() {
        var b [0]byte;
-       s := string(b); // out of bounds trap
+       s := string(&b);        // out of bounds trap
        if s != "" {
                panic("bad convert")
        }
        var b1 = [5]byte{'h', 'e', 'l', 'l', 'o'};
-       if string(b1) != "hello" {
+       if string(&b1) != "hello" {
                panic("bad convert 1")
        }
        var b2 = make([]byte, 5);
index 850ddccf69b9f5f526f901e48989cd69f89a0b67..a823e92835675317e1ce97a576e98435a9bcd1df 100644 (file)
@@ -86,7 +86,7 @@ main()
        z1[0] = 'a';
        z1[1] = 'b';
        z1[2] = 'c';
-       c = string(z1);
+       c = string(&z1);
        if c != "abc" {
                panic("create array ", c);
        }
@@ -96,7 +96,7 @@ main()
        z2[0] = 'a';
        z2[1] = 'b';
        z2[2] = 'c';
-       c = string(*z2);
+       c = string(z2);
        if c != "abc" {
                panic("create array pointer ", c);
        }