aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-03-26 05:45:31 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-03-26 05:45:31 +0000
commit2fbb4d751b0fc9ce11632570f71e267420d36384 (patch)
tree7d6abd93a127ca98520aefce6511d5d42dff52b3 /gcc
parente2e5c70f5c999df78a5d1edd8b87651d08d72400 (diff)
downloadgcc-2fbb4d751b0fc9ce11632570f71e267420d36384.zip
gcc-2fbb4d751b0fc9ce11632570f71e267420d36384.tar.gz
gcc-2fbb4d751b0fc9ce11632570f71e267420d36384.tar.bz2
Better error when setting const to nil.
From-SVN: r171541
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/gogo.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index a09ffb3..9001d2b 100644
--- 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();
}