diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2014-11-24 17:10:20 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2014-11-24 17:10:20 +0000 |
commit | d9d8d4e53f6c82a64ef38ddf899a7419d099b59e (patch) | |
tree | 54d11f18f3f0713881ccd5fa376404737904c8f2 /gcc | |
parent | ea903c37300bdafd4592f0e979cfede05aaf258e (diff) | |
download | gcc-d9d8d4e53f6c82a64ef38ddf899a7419d099b59e.zip gcc-d9d8d4e53f6c82a64ef38ddf899a7419d099b59e.tar.gz gcc-d9d8d4e53f6c82a64ef38ddf899a7419d099b59e.tar.bz2 |
compiler: Do not dereference a named pointer type when looking up a method.
Fixes Issue 9018.
From-SVN: r218026
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/types.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index ba07461..c85c72c 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -10035,6 +10035,18 @@ Type::find_field_or_method(const Type* type, if (found_level == 0) return false; + else if (found_is_method + && type->named_type() != NULL + && type->points_to() != NULL) + { + // If this is a method inherited from a struct field in a named pointer + // type, it is invalid to automatically dereference the pointer to the + // struct to find this method. + if (level != NULL) + *level = found_level; + *is_method = true; + return false; + } else if (!found_ambig1.empty()) { go_assert(!found_ambig1.empty()); |