Commit 955638e2 authored by Russ Cox's avatar Russ Cox

disallow ordinary-type.(T), as in spec.

R=ken
OCL=25705
CL=25705
parent 461dd912
......@@ -2851,6 +2851,9 @@ ifaceas1(Type *dst, Type *src, int explicit)
if(src == T || dst == T)
return Inone;
if(explicit && !isinter(src))
yyerror("cannot use .(T) on non-interface type %T", src);
if(isinter(dst)) {
if(isinter(src)) {
if(eqtype(dst, src, 0))
......
......@@ -107,7 +107,8 @@ func newBasicType(name string, kind int, size int) Type {
// Prebuilt basic types
var (
Missing = newBasicType(missingString, MissingKind, 1);
DotDotDot = newBasicType(dotDotDotString, DotDotDotKind, unsafe.Sizeof(true.(interface{})));
empty interface{};
DotDotDot = newBasicType(dotDotDotString, DotDotDotKind, unsafe.Sizeof(empty));
Bool = newBasicType("bool", BoolKind, unsafe.Sizeof(true));
Int = newBasicType("int", IntKind, unsafe.Sizeof(int(0)));
Int8 = newBasicType("int8", Int8Kind, 1);
......
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