Source file src/internal/types/testdata/fixedbugs/issue51877.go

     1  // Copyright 2013 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package p
     6  
     7  type S struct {
     8  	f1 int
     9  	f2 bool
    10  }
    11  
    12  var (
    13  	_ = S{0}                    /* ERROR "too few values in struct literal" */
    14  	_ = struct{ f1, f2 int }{0} /* ERROR "too few values in struct literal" */
    15  
    16  	_ = S{0, true, "foo" /* ERROR "too many values in struct literal" */}
    17  	_ = struct{ f1, f2 int }{0, 1, 2 /* ERROR "too many values in struct literal" */}
    18  )
    19  

View as plain text