2012-02-16 21:48:57 -07:00
|
|
|
// errorcheck
|
2008-10-16 16:59:31 -06: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 19:19:43 -07:00
|
|
|
// Verify that illegal uses of composite literals are detected.
|
|
|
|
// Does not compile.
|
|
|
|
|
2008-10-16 16:59:31 -06:00
|
|
|
package main
|
|
|
|
|
2009-08-03 12:58:52 -06:00
|
|
|
var a = []int { "a" }; // ERROR "conver|incompatible|cannot"
|
2009-03-03 09:39:12 -07:00
|
|
|
var b = int { 1 }; // ERROR "compos"
|
2008-10-16 16:59:31 -06:00
|
|
|
|
|
|
|
|
2009-01-16 17:12:14 -07:00
|
|
|
func f() int
|
|
|
|
|
2008-10-16 16:59:31 -06:00
|
|
|
func main() {
|
2009-08-03 12:58:52 -06:00
|
|
|
if f < 1 { } // ERROR "conver|incompatible|invalid"
|
2008-10-16 16:59:31 -06:00
|
|
|
}
|