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