From 3c1917945db0b725842fd39e76c39e7de049afa4 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 20 Sep 2016 17:52:23 +0000 Subject: [PATCH] =?utf8?q?re=20PR=20go/77625=20(go/gofrontend/ast-dump.cc:?= =?utf8?q?169:42:=20error:=20=E2=80=98new=E2=80=99=20of=20type=20=E2=80=98?= =?utf8?q?std::ofstr=20eam=20{aka=20std::basic=5Fofstream}=E2=80=99?= =?utf8?q?=20with=20extended=20alignment=2016)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit PR go/77625 compiler: allocate std::ofstream as a local variable GCC PR 77625 points out a warning about new std::ofstream. I don't know how that is supposed to work, but in this case the std::ofstream may as well be a local variable anyhow. Reviewed-on: https://go-review.googlesource.com/29435 From-SVN: r240279 --- gcc/go/gofrontend/MERGE | 2 +- gcc/go/gofrontend/ast-dump.cc | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index dbe86f67301..48d19462897 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -80720773ac1a3433b7de59ffa5c04744123247c3 +57d120d75be87c2a0da67e750f16929891f1b8f4 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/ast-dump.cc b/gcc/go/gofrontend/ast-dump.cc index 72b01420aa3..8dad18c4f05 100644 --- a/gcc/go/gofrontend/ast-dump.cc +++ b/gcc/go/gofrontend/ast-dump.cc @@ -166,24 +166,24 @@ const char* kAstDumpFileExtension = ".dump.ast"; void Ast_dump_context::dump(Gogo* gogo, const char* basename) { - std::ofstream* out = new std::ofstream(); + std::ofstream out; std::string dumpname(basename); dumpname += ".dump.ast"; - out->open(dumpname.c_str()); + out.open(dumpname.c_str()); - if (out->fail()) + if (out.fail()) { error("cannot open %s:%m, -fgo-dump-ast ignored", dumpname.c_str()); return; } this->gogo_ = gogo; - this->ostream_ = out; + this->ostream_ = &out; Ast_dump_traverse_blocks_and_functions adtbf(this); gogo->traverse(&adtbf); - out->close(); + out.close(); } // Dump a textual representation of a type to the -- 2.30.2