blob: 85f1e4b81e91fea4c9b3dee5851d5025140aab69 [file] [log] [blame]
Russ Coxd2cc9882012-02-16 23:50:37 -05001// errorcheck
Russ Cox4cf77112009-01-30 14:39:31 -08002
3// Copyright 2009 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
Rob Pike83976e32012-02-19 14:28:53 +11007// Verify that it is illegal to take the address of a function.
8// Does not compile.
9
Russ Cox4cf77112009-01-30 14:39:31 -080010package main
11
12var notmain func()
13
14func main() {
Rob Pike4f61fc92010-09-04 10:36:13 +100015 var x = &main // ERROR "address of|invalid"
16 main = notmain // ERROR "assign to|invalid"
Ian Lance Taylor387e7c22012-01-22 11:50:45 -080017 _ = x
Russ Cox4cf77112009-01-30 14:39:31 -080018}