Russ Cox | 57eb06f | 2012-02-16 23:51:04 -0500 | [diff] [blame] | 1 | // errorcheck |
Russ Cox | 689b28f | 2008-10-24 14:56:54 -0700 | [diff] [blame] | 2 | |
| 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 Pike | 501f0b5 | 2012-02-23 18:47:26 +1100 | [diff] [blame] | 7 | // Verify that method redeclarations are caught by the compiler. |
| 8 | // Does not compile. |
| 9 | |
Russ Cox | 689b28f | 2008-10-24 14:56:54 -0700 | [diff] [blame] | 10 | package main |
| 11 | |
Russ Cox | 839a684 | 2009-01-20 14:40:40 -0800 | [diff] [blame] | 12 | type T struct { } |
Rob Pike | 4f61fc9 | 2010-09-04 10:36:13 +1000 | [diff] [blame] | 13 | func (t *T) M(int, string) // GCCGO_ERROR "previous" |
Ian Lance Taylor | 68683a6 | 2011-01-21 08:37:58 -0800 | [diff] [blame] | 14 | func (t *T) M(int, float64) { } // ERROR "redeclared|redefinition" |
Russ Cox | 689b28f | 2008-10-24 14:56:54 -0700 | [diff] [blame] | 15 | |
Rob Pike | 4f61fc9 | 2010-09-04 10:36:13 +1000 | [diff] [blame] | 16 | func f(int, string) // GCCGO_ERROR "previous" |
Ian Lance Taylor | 68683a6 | 2011-01-21 08:37:58 -0800 | [diff] [blame] | 17 | func f(int, float64) { } // ERROR "redeclared|redefinition" |
Russ Cox | 689b28f | 2008-10-24 14:56:54 -0700 | [diff] [blame] | 18 | |
Rob Pike | 4f61fc9 | 2010-09-04 10:36:13 +1000 | [diff] [blame] | 19 | func g(a int, b string) // GCCGO_ERROR "previous" |
| 20 | func g(a int, c string) // ERROR "redeclared|redefinition" |