projects
/
gcc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e2e5c70
)
Better error when setting const to nil.
author
Ian Lance Taylor
<ian@gcc.gnu.org>
Sat, 26 Mar 2011 05:45:31 +0000
(
05:45
+0000)
committer
Ian Lance Taylor
<ian@gcc.gnu.org>
Sat, 26 Mar 2011 05:45:31 +0000
(
05:45
+0000)
From-SVN: r171541
gcc/go/gofrontend/gogo.cc
patch
|
blob
|
history
diff --git
a/gcc/go/gofrontend/gogo.cc
b/gcc/go/gofrontend/gogo.cc
index a09ffb3aaec95529a9574c598ef9d10fb69bbce9..9001d2b9ea7becaf7fd4cfb06701cccd7325f545 100644
(file)
--- a/
gcc/go/gofrontend/gogo.cc
+++ b/
gcc/go/gofrontend/gogo.cc
@@
-1527,7
+1527,9
@@
Check_types_traverse::constant(Named_object* named_object, bool)
&& !ctype->is_boolean_type()
&& !ctype->is_string_type())
{
- if (!ctype->is_error())
+ if (ctype->is_nil_type())
+ error_at(constant->location(), "const initializer cannot be nil");
+ else if (!ctype->is_error())
error_at(constant->location(), "invalid constant type");
constant->set_error();
}