public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-7067] compiler: accept "any" as an alias for "interface{}" Date: Sat, 5 Feb 2022 00:45:10 +0000 (GMT) [thread overview] Message-ID: <20220205004510.C32813858D20@sourceware.org> (raw) https://gcc.gnu.org/g:b523cae81c64c3557f3918ce01419242c4238009 commit r12-7067-gb523cae81c64c3557f3918ce01419242c4238009 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Feb 1 14:44:20 2022 -0800 compiler: accept "any" as an alias for "interface{}" For golang/go#33232 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/382248 Diff: --- gcc/go/gofrontend/MERGE | 2 +- gcc/go/gofrontend/gogo.cc | 9 +++++++++ gcc/testsuite/go.test/test/fixedbugs/issue14652.go | 5 +++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index a42d88d25c4..f78561c3483 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -7d510bf5fcec9b0ccc0282f4193a80c0a164df63 +61f7cf4b9db0587ff099aa36832a355b90ee1bf9 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index e2fd509f58a..b1e210ee6ac 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -141,6 +141,15 @@ Gogo::Gogo(Backend* backend, Linemap* linemap, int, int pointer_size) this->add_named_type(error_type); } + // "any" is an alias for the empty interface type. + { + Type* empty = Type::make_empty_interface_type(loc); + Named_object* no = Named_object::make_type("any", NULL, empty, loc); + Named_type* nt = no->type_value(); + nt->set_is_alias(); + this->add_named_type(nt); + } + this->globals_->add_constant(Typed_identifier("true", Type::make_boolean_type(), loc), diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue14652.go b/gcc/testsuite/go.test/test/fixedbugs/issue14652.go index d53b4126683..586663b676f 100644 --- a/gcc/testsuite/go.test/test/fixedbugs/issue14652.go +++ b/gcc/testsuite/go.test/test/fixedbugs/issue14652.go @@ -1,4 +1,4 @@ -// errorcheck +// compile // Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style @@ -6,4 +6,5 @@ package p -var x any // ERROR "undefined: any|undefined type .*any.*" +// any is now permitted instead of interface{} +var x any
reply other threads:[~2022-02-05 0:45 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220205004510.C32813858D20@sourceware.org \ --to=ian@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).