OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [complit1.go] - Blame information for rev 700

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 700 jeremybenn
// errchk $G -e $D/$F.go
2
 
3
// Copyright 2011 The Go Authors.  All rights reserved.
4
// Use of this source code is governed by a BSD-style
5
// license that can be found in the LICENSE file.
6
 
7
package main
8
 
9
var m map[int][3]int
10
 
11
func f() [3]int
12
 
13
func fp() *[3]int
14
 
15
var mp map[int]*[3]int
16
 
17
var (
18
        _ = [3]int{1, 2, 3}[:] // ERROR "slice of unaddressable value"
19
        _ = m[0][:]            // ERROR "slice of unaddressable value"
20
        _ = f()[:]             // ERROR "slice of unaddressable value"
21
 
22
        // these are okay because they are slicing a pointer to an array
23
        _ = (&[3]int{1, 2, 3})[:]
24
        _ = mp[0][:]
25
        _ = fp()[:]
26
)
27
 
28
type T struct {
29
        i    int
30
        f    float64
31
        s    string
32
        next *T
33
}
34
 
35
var (
36
        _ = &T{0, 0, "", nil}               // ok
37
        _ = &T{i: 0, f: 0, s: "", next: {}} // ERROR "missing type in composite literal|omit types within composite literal"
38
        _ = &T{0, 0, "", {}}                // ERROR "missing type in composite literal|omit types within composite literal"
39
)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.