Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
f10a7882
Commit
f10a7882
authored
Apr 21, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: another pointer to interface message
R=ken2 CC=golang-dev
https://golang.org/cl/4444056
parent
5ff33364
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
subr.c
src/cmd/gc/subr.c
+7
-6
pointer.go
test/interface/pointer.go
+1
-0
No files found.
src/cmd/gc/subr.c
View file @
f10a7882
...
@@ -1928,13 +1928,14 @@ assignop(Type *src, Type *dst, char **why)
...
@@ -1928,13 +1928,14 @@ assignop(Type *src, Type *dst, char **why)
}
}
return
0
;
return
0
;
}
}
if
(
isptrto
(
dst
,
TINTER
))
{
if
(
why
!=
nil
)
*
why
=
smprint
(
":
\n\t
%T is pointer to interface, not interface"
,
dst
);
return
0
;
}
if
(
src
->
etype
==
TINTER
&&
dst
->
etype
!=
TBLANK
)
{
if
(
src
->
etype
==
TINTER
&&
dst
->
etype
!=
TBLANK
)
{
if
(
why
!=
nil
)
{
if
(
why
!=
nil
)
if
(
isptrto
(
dst
,
TINTER
))
*
why
=
": need type assertion"
;
*
why
=
smprint
(
":
\n\t
%T is interface, not pointer to interface"
,
src
);
else
*
why
=
": need type assertion"
;
}
return
0
;
return
0
;
}
}
...
...
test/interface/pointer.go
View file @
f10a7882
...
@@ -33,4 +33,5 @@ func main() {
...
@@ -33,4 +33,5 @@ func main() {
print
(
"call addinst
\n
"
)
print
(
"call addinst
\n
"
)
var
x
Inst
=
AddInst
(
new
(
Start
))
// ERROR "pointer to interface"
var
x
Inst
=
AddInst
(
new
(
Start
))
// ERROR "pointer to interface"
print
(
"return from addinst
\n
"
)
print
(
"return from addinst
\n
"
)
var
x
*
Inst
=
new
(
Start
)
// ERROR "pointer to interface"
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment