-65672c16004c6d6d0247b6691881d282ffca89e3
+a63e173b20baa1a48470dd31a1fb1f2704b37011
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
}
}
+ // According to the language specification on string conversions
+ // (http://golang.org/ref/spec#Conversions_to_and_from_a_string_type):
+ // When converting an integer into a string, the string will be a UTF-8
+ // representation of the integer and integers "outside the range of valid
+ // Unicode code points are converted to '\uFFFD'."
+ if (type->is_string_type())
+ {
+ Numeric_constant nc;
+ if (val->numeric_constant_value(&nc) && nc.is_int())
+ {
+ // An integer value doesn't fit in the Unicode code point range if it
+ // overflows the Go "int" type or is negative.
+ unsigned long ul;
+ if (!nc.set_type(Type::lookup_integer_type("int"), false, location)
+ || nc.to_unsigned_long(&ul) == Numeric_constant::NC_UL_NEGATIVE)
+ return Expression::make_string("\ufffd", location);
+ }
+ }
+
if (type->is_slice_type())
{
Type* element_type = type->array_type()->element_type()->forwarded();