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 {
|
|
|
|
int;
|
|
|
|
sync.Mutex;
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
{
|
|
|
|
var x, y sync.Mutex;
|
2009-10-09 01:39:32 -06:00
|
|
|
x = y; // ERROR "assignment.*Mutex"
|
2009-09-15 13:42:24 -06:00
|
|
|
_ = x;
|
2009-05-21 15:06:24 -06:00
|
|
|
}
|
|
|
|
{
|
|
|
|
var x, y T;
|
2009-10-09 01:39:32 -06:00
|
|
|
x = y; // ERROR "assignment.*Mutex"
|
2009-09-15 13:42:24 -06:00
|
|
|
_ = x;
|
2009-05-21 15:06:24 -06:00
|
|
|
}
|
|
|
|
{
|
|
|
|
var x, y [2]sync.Mutex;
|
2009-10-09 01:39:32 -06:00
|
|
|
x = y; // ERROR "assignment.*Mutex"
|
2009-09-15 13:42:24 -06:00
|
|
|
_ = x;
|
2009-05-21 15:06:24 -06:00
|
|
|
}
|
|
|
|
{
|
|
|
|
var x, y [2]T;
|
2009-10-09 01:39:32 -06:00
|
|
|
x = y; // ERROR "assignment.*Mutex"
|
2009-09-15 13:42:24 -06:00
|
|
|
_ = x;
|
2009-05-21 15:06:24 -06:00
|
|
|
}
|
2009-11-15 13:57:09 -07:00
|
|
|
{
|
|
|
|
x := sync.Mutex{0, 0}; // ERROR "assignment.*Mutex"
|
|
|
|
_ = x;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
x := sync.Mutex{key: 0}; // ERROR "(unknown|assignment).*Mutex"
|
|
|
|
_ = x;
|
|
|
|
}
|
2009-12-03 23:09:58 -07:00
|
|
|
{
|
|
|
|
x := &sync.Mutex{}; // ok
|
|
|
|
var y sync.Mutex; // ok
|
|
|
|
y = *x; // ERROR "assignment.*Mutex"
|
|
|
|
*x = y; // ERROR "assignment.*Mutex"
|
|
|
|
_ = x;
|
|
|
|
_ = y;
|
|
|
|
}
|
2009-05-21 15:06:24 -06:00
|
|
|
}
|