compiler: don't try to get backend representation of redefinition
commitbb6a635bb535d2653ddad10dd8c70895e609f9eb
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 13 Oct 2016 16:21:28 +0000 (13 16:21 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 13 Oct 2016 16:21:28 +0000 (13 16:21 +0000)
tree403169efef8464ce3d59a9035abc31e34b98bd29
parentc12f1bf5dc3d221a474a847caa338dae902dfe91
compiler: don't try to get backend representation of redefinition

    Trying to get the backend representation of a redefined name can cause a
    compiler crash as the compiler can walk over the same statements a
    second time.  It's also quite unlikely to produce any additional useful
    error messages for the user.

    Test case follows.  I'm not going to bother adding this test case to the
    testsuite--crash-on-invalid cases are worth fixing but not worth
    continually retesting.

    package p

    type A []int

    func (a A) Sum() (sum int) {
     for _, v := range a {
     sum += v
     }
     return sum
    }

    type A []int

    func (a A) Sum() (sum int) {
     for _, v := range a {
     sum += v
     }
     return sum
    }

    Reviewed-on: https://go-review.googlesource.com/30976

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241127 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/gogo.cc