blob: 6be3bf0184d386f436fd3d7a1044b26da8084613 [file] [log] [blame]
Russ Coxd2cc9882012-02-16 23:50:37 -05001// errorcheck
Russ Cox5ed04d72008-09-30 14:08:43 -07002
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 illegal function signatures are detected.
8// Does not compile.
9
Russ Cox5ed04d72008-09-30 14:08:43 -070010package main
11
Rob Pike4f61fc92010-09-04 10:36:13 +100012type t1 int
13type t2 int
14type t3 int
Russ Cox5ed04d72008-09-30 14:08:43 -070015
Rob Pike4f61fc92010-09-04 10:36:13 +100016func f1(*t2, x t3) // ERROR "named"
17func f2(t1, *t2, x t3) // ERROR "named"
18func f3() (x int, *string) // ERROR "named"
Russ Cox5ed04d72008-09-30 14:08:43 -070019
Rob Pike4f61fc92010-09-04 10:36:13 +100020func f4() (t1 t1) // legal - scope of parameter named t1 starts in body of f4.