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
0acb6376
Commit
0acb6376
authored
Sep 11, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: const nil bug
Fixes #1073. R=ken2 CC=golang-dev
https://golang.org/cl/2169043
parent
fa0c53da
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
walk.c
src/cmd/gc/walk.c
+4
-0
const1.go
test/const1.go
+2
-0
No files found.
src/cmd/gc/walk.c
View file @
0acb6376
...
...
@@ -261,6 +261,10 @@ walkdef(Node *n)
yyerror
(
"const initializer must be constant"
);
goto
ret
;
}
if
(
isconst
(
e
,
CTNIL
))
{
yyerror
(
"const initializer cannot be nil"
);
goto
ret
;
}
t
=
n
->
type
;
if
(
t
!=
T
)
{
convlit
(
&
e
,
t
);
...
...
test/const1.go
View file @
0acb6376
...
...
@@ -77,3 +77,5 @@ func main() {
f
(
String
)
// ERROR "convert|wrong type|cannot|incompatible"
f
(
Bool
)
// ERROR "convert|wrong type|cannot|incompatible"
}
const
ptr
=
nil
// ERROR "const.*nil"
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