From 43c0a46ac6a68d931cc7e067ba9156fb08d5de43 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 24 May 2010 15:25:09 -0700 Subject: [PATCH] gc: bug280 Fixes #808. R=ken2 CC=golang-dev https://golang.org/cl/1273042 --- src/cmd/gc/align.c | 2 ++ test/fixedbugs/bug280.go | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 test/fixedbugs/bug280.go diff --git a/src/cmd/gc/align.c b/src/cmd/gc/align.c index 00dd9d88eaa..0d4fa991f3f 100644 --- a/src/cmd/gc/align.c +++ b/src/cmd/gc/align.c @@ -239,6 +239,8 @@ dowidth(Type *t) w = sizeof_Array; checkwidth(t->type); } + else if(t->bound == -100) + yyerror("use of [...] array outside of array literal"); else fatal("dowidth %T", t); // probably [...]T break; diff --git a/test/fixedbugs/bug280.go b/test/fixedbugs/bug280.go new file mode 100644 index 00000000000..869d446268c --- /dev/null +++ b/test/fixedbugs/bug280.go @@ -0,0 +1,13 @@ +// errchk $G $D/$F.go + +// Copyright 2010 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. + +// http://code.google.com/p/go/issues/detail?id=808 + +package main + +type A [...]int // ERROR "outside of array literal" + +