summaryrefslogtreecommitdiffstats
path: root/llgo/test/execution/literals/slice.go
blob: dbb02bff718ded28e5ea962059da353e7e98cf1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// RUN: llgo -o %t %s
// RUN: %t 2>&1 | FileCheck %s

// CHECK: abc
// CHECK-NEXT: 123
// CHECK-NEXT: abc
// CHECK-NEXT: 123

package main

func main() {
	x := []string{"abc", "123"}
	println(x[0])
	println(x[1])

	// Elements are composite literals, so the '&' can be elided.
	type S struct{ string }
	y := []*S{{"abc"}, {"123"}}
	println(y[0].string)
	println(y[1].string)
}
OpenPOWER on IntegriCloud