diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-03-30 17:32:06 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-03-30 17:32:06 +0000 |
commit | c40b69ae69f5e510704ee0b4a1a293057a6f4cd2 (patch) | |
tree | e319dd01e8bab96b8da54527fdd51675252ba7b4 /gcc | |
parent | 233b9db6fb3aef2ec39fd66c54ac064a7737732c (diff) | |
download | gcc-c40b69ae69f5e510704ee0b4a1a293057a6f4cd2.zip gcc-c40b69ae69f5e510704ee0b4a1a293057a6f4cd2.tar.gz gcc-c40b69ae69f5e510704ee0b4a1a293057a6f4cd2.tar.bz2 |
compiler: implement Go 1 unsafe.Pointer conversion rules
Any type whose underlying type is uintptr can be converted
to unsafe.Pointer, and vice versa.
Fixes golang/go#10284.
From-SVN: r221774
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/types.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 785889f..e93c681 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -772,16 +772,16 @@ Type::are_convertible(const Type* lhs, const Type* rhs, std::string* reason) } // An unsafe.Pointer type may be converted to any pointer type or to - // uintptr, and vice-versa. + // a type whose underlying type is uintptr, and vice-versa. if (lhs->is_unsafe_pointer_type() && (rhs->points_to() != NULL || (rhs->integer_type() != NULL - && rhs->forwarded() == Type::lookup_integer_type("uintptr")))) + && rhs->integer_type() == Type::lookup_integer_type("uintptr")->real_type()))) return true; if (rhs->is_unsafe_pointer_type() && (lhs->points_to() != NULL || (lhs->integer_type() != NULL - && lhs->forwarded() == Type::lookup_integer_type("uintptr")))) + && lhs->integer_type() == Type::lookup_integer_type("uintptr")->real_type()))) return true; // Give a better error message. |