Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
307a899d
Commit
307a899d
authored
Jan 08, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: bug238
Fixes #471. R=ken2 CC=golang-dev
https://golang.org/cl/181184
parent
1b1f39eb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
16 deletions
+27
-16
src/cmd/gc/const.c
src/cmd/gc/const.c
+4
-0
src/cmd/gc/walk.c
src/cmd/gc/walk.c
+4
-1
test/fixedbugs/bug238.go
test/fixedbugs/bug238.go
+19
-0
test/golden.out
test/golden.out
+0
-15
No files found.
src/cmd/gc/const.c
View file @
307a899d
...
@@ -186,6 +186,10 @@ convlit1(Node **np, Type *t, int explicit)
...
@@ -186,6 +186,10 @@ convlit1(Node **np, Type *t, int explicit)
return
;
return
;
bad:
bad:
if
(
!
n
->
diag
)
{
yyerror
(
"cannot convert %#N to type %T"
,
n
,
t
);
n
->
diag
=
1
;
}
if
(
isideal
(
n
->
type
))
{
if
(
isideal
(
n
->
type
))
{
defaultlit
(
&
n
,
T
);
defaultlit
(
&
n
,
T
);
*
np
=
n
;
*
np
=
n
;
...
...
src/cmd/gc/walk.c
View file @
307a899d
...
@@ -180,8 +180,11 @@ walkdef(Node *n)
...
@@ -180,8 +180,11 @@ walkdef(Node *n)
goto
ret
;
goto
ret
;
}
}
t
=
n
->
type
;
t
=
n
->
type
;
if
(
t
!=
T
)
if
(
t
!=
T
)
{
convlit
(
&
e
,
t
);
convlit
(
&
e
,
t
);
if
(
!
isint
[
t
->
etype
]
&&
!
isfloat
[
t
->
etype
]
&&
t
->
etype
!=
TSTRING
)
yyerror
(
"invalid constant type %T"
,
t
);
}
n
->
val
=
e
->
val
;
n
->
val
=
e
->
val
;
n
->
type
=
e
->
type
;
n
->
type
=
e
->
type
;
break
;
break
;
...
...
test/bugs/bug238.go
→
test/
fixed
bugs/bug238.go
View file @
307a899d
...
@@ -8,12 +8,12 @@
...
@@ -8,12 +8,12 @@
package
main
package
main
const
a
*
int
=
1
// ERROR "wrong|incompatible"
const
a
*
int
=
1
// ERROR "
convert|
wrong|incompatible"
const
b
[
2
]
int
=
2
// ERROR "wrong|incompatible"
const
b
[
2
]
int
=
2
// ERROR "
convert|
wrong|incompatible"
const
c
map
[
int
]
int
=
3
// ERROR "wrong|incompatible"
const
c
map
[
int
]
int
=
3
// ERROR "
convert|
wrong|incompatible"
const
d
chan
int
=
4
// ERROR "wrong|incompatible"
const
d
chan
int
=
4
// ERROR "
convert|
wrong|incompatible"
const
e
func
()
=
5
// ERROR "wrong|incompatible"
const
e
func
()
=
5
// ERROR "
convert|
wrong|incompatible"
const
f
struct
{}
=
6
// ERROR "wrong|incompatible"
const
f
struct
{}
=
6
// ERROR "
convert|
wrong|incompatible"
const
g
interface
{}
=
7
// ERROR "wrong|incompatible"
const
g
interface
{}
=
7
// ERROR "
constant|
wrong|incompatible"
func
main
()
{
println
(
a
,
b
,
c
,
d
,
e
,
f
,
g
)
}
func
main
()
{
println
(
a
,
b
,
c
,
d
,
e
,
f
,
g
)
}
test/golden.out
View file @
307a899d
...
@@ -144,18 +144,3 @@ throw: interface conversion
...
@@ -144,18 +144,3 @@ throw: interface conversion
panic PC=xxx
panic PC=xxx
== bugs/
== bugs/
=========== bugs/bug219.go
bugs/bug219.go:16: syntax error near if
BUG: bug219
=========== bugs/bug238.go
BUG: errchk: command succeeded unexpectedly
=========== bugs/bug239.go
bugs/bug239.go:11: imported and not used: unsafe
bugs/bug239.go:15: undefined: Sizeof
BUG: bug239
=========== bugs/bug240.go
BUG: errchk: command succeeded unexpectedly
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