2009-11-15 13:57:09 -07:00
|
|
|
// errchk $G -e $D/$F.go
|
2009-05-21 15:06:24 -06:00
|
|
|
|
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import "sync"
|
|
|
|
|
|
|
|
type T struct {
|
2010-09-03 18:36:13 -06:00
|
|
|
int
|
|
|
|
sync.Mutex
|
2009-05-21 15:06:24 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
{
|
2010-09-03 18:36:13 -06:00
|
|
|
var x, y sync.Mutex
|
|
|
|
x = y // ERROR "assignment.*Mutex"
|
|
|
|
_ = x
|
2009-05-21 15:06:24 -06:00
|
|
|
}
|
|
|
|
{
|
2010-09-03 18:36:13 -06:00
|
|
|
var x, y T
|
|
|
|
x = y // ERROR "assignment.*Mutex"
|
|
|
|
_ = x
|
2009-05-21 15:06:24 -06:00
|
|
|
}
|
|
|
|
{
|
2010-09-03 18:36:13 -06:00
|
|
|
var x, y [2]sync.Mutex
|
|
|
|
x = y // ERROR "assignment.*Mutex"
|
|
|
|
_ = x
|
2009-05-21 15:06:24 -06:00
|
|
|
}
|
|
|
|
{
|
2010-09-03 18:36:13 -06:00
|
|
|
var x, y [2]T
|
|
|
|
x = y // ERROR "assignment.*Mutex"
|
|
|
|
_ = x
|
2009-05-21 15:06:24 -06:00
|
|
|
}
|
2009-11-15 13:57:09 -07:00
|
|
|
{
|
2010-09-03 18:36:13 -06:00
|
|
|
x := sync.Mutex{0, 0} // ERROR "assignment.*Mutex"
|
|
|
|
_ = x
|
2009-11-15 13:57:09 -07:00
|
|
|
}
|
|
|
|
{
|
2010-09-03 18:36:13 -06:00
|
|
|
x := sync.Mutex{key: 0} // ERROR "(unknown|assignment).*Mutex"
|
|
|
|
_ = x
|
2009-11-15 13:57:09 -07:00
|
|
|
}
|
2009-12-03 23:09:58 -07:00
|
|
|
{
|
2010-09-03 18:36:13 -06:00
|
|
|
x := &sync.Mutex{} // ok
|
|
|
|
var y sync.Mutex // ok
|
|
|
|
y = *x // ERROR "assignment.*Mutex"
|
|
|
|
*x = y // ERROR "assignment.*Mutex"
|
|
|
|
_ = x
|
|
|
|
_ = y
|
2009-12-03 23:09:58 -07:00
|
|
|
}
|
2009-05-21 15:06:24 -06:00
|
|
|
}
|