2012-02-17 04:50:37 +00:00
|
|
|
// errorcheck
|
2009-01-30 22:39:31 +00: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.
|
|
|
|
|
2012-02-19 03:28:53 +00:00
|
|
|
// Verify that it is illegal to take the address of a function.
|
|
|
|
// Does not compile.
|
|
|
|
|
2009-01-30 22:39:31 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
var notmain func()
|
|
|
|
|
|
|
|
func main() {
|
2010-09-04 00:36:13 +00:00
|
|
|
var x = &main // ERROR "address of|invalid"
|
|
|
|
main = notmain // ERROR "assign to|invalid"
|
2012-01-22 19:50:45 +00:00
|
|
|
_ = x
|
2009-01-30 22:39:31 +00:00
|
|
|
}
|