blob: 365b8ca553dafe8490611fc56ca91acd3c4f7564 [file] [log] [blame]
Russ Cox57eb06f2012-02-16 23:51:04 -05001// errorcheck
Russ Cox689b28f2008-10-24 14:56:54 -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 Pike501f0b52012-02-23 18:47:26 +11007// Verify that method redeclarations are caught by the compiler.
8// Does not compile.
9
Russ Cox689b28f2008-10-24 14:56:54 -070010package main
11
Russ Cox839a6842009-01-20 14:40:40 -080012type T struct { }
Rob Pike4f61fc92010-09-04 10:36:13 +100013func (t *T) M(int, string) // GCCGO_ERROR "previous"
Ian Lance Taylor68683a62011-01-21 08:37:58 -080014func (t *T) M(int, float64) { } // ERROR "redeclared|redefinition"
Russ Cox689b28f2008-10-24 14:56:54 -070015
Rob Pike4f61fc92010-09-04 10:36:13 +100016func f(int, string) // GCCGO_ERROR "previous"
Ian Lance Taylor68683a62011-01-21 08:37:58 -080017func f(int, float64) { } // ERROR "redeclared|redefinition"
Russ Cox689b28f2008-10-24 14:56:54 -070018
Rob Pike4f61fc92010-09-04 10:36:13 +100019func g(a int, b string) // GCCGO_ERROR "previous"
20func g(a int, c string) // ERROR "redeclared|redefinition"