From: Ian Lance Taylor Date: Sat, 26 Mar 2011 05:45:31 +0000 (+0000) Subject: Better error when setting const to nil. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2fbb4d751b0fc9ce11632570f71e267420d36384;p=gcc.git Better error when setting const to nil. From-SVN: r171541 --- diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index a09ffb3aaec..9001d2b9ea7 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(); }