Commit dbabeb1d authored by Russ Cox's avatar Russ Cox

reject new of function type

R=ken
OCL=17598
CL=17598
parent f0e93e8c
...@@ -1824,6 +1824,10 @@ newcompat(Node *n) ...@@ -1824,6 +1824,10 @@ newcompat(Node *n)
t = t->type; t = t->type;
switch(t->etype) { switch(t->etype) {
case TFUNC:
yyerror("cannot make new %T", t);
break;
case TMAP: case TMAP:
r = mapop(n, Erv); r = mapop(n, Erv);
return r; return r;
......
// 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.
// errchk $G $D/$F.go
package main
func main()
{
f := new(()); // ERROR "new"
g := new((x int, f float) string); // ERROR "new"
h := new(*()); // ok
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment