summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmd/gc/walk.c3
-rw-r--r--src/lib/reflect/type.go3
2 files changed, 5 insertions, 1 deletions
diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c
index c7deefc91..3ae0f52f7 100644
--- a/src/cmd/gc/walk.c
+++ b/src/cmd/gc/walk.c
@@ -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))
diff --git a/src/lib/reflect/type.go b/src/lib/reflect/type.go
index 438f5b232..96953f3b0 100644
--- a/src/lib/reflect/type.go
+++ b/src/lib/reflect/type.go
@@ -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);