public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/32402] Error while allocating array of pointers to objects of a pure virtual class Date: Sun, 31 Oct 2010 11:31:00 -0000 [thread overview] Message-ID: <20101031113100.dgvYoTLgs4UbwJHZOuwfZmtDSbpuPtRdIOarH1VBFJk@z> (raw) In-Reply-To: <bug-32402-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32402 --- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-31 11:31:01 UTC --- (In reply to comment #10) > Ok, I've read the bug report following a report from a friend, and after > checking various sources I've come to the following conclusion: > > new pure(*[3]) is not valid That's not what the bug report contains though! It's "new (pure(*[3]))" with an extra set of parentheses around the type, so according to the grammar "pure(*[3])" must be parsed as a type-id, there is no initializer > When parsed, "new pure(*[3])" is parsed as "new instance of class pure with > parameter *[3]". Right, and it's not accepted, see comment 5: > - "list = new pure(*[3]);" => does not compile But that's a different case to "new (pure(*[3]))" which is what this PR is about. > Anyway I see no logical reason why one would want to put part of its allocation > into parenthesis. > > "new pure*[3]" should be perfectly acceptable, is easier to read, and is > accepted by GCC without problems. That's beside the point, if the grammar is valid then it should be accepted. > Jonathan Wakely's example with decltype() is non related as decltype() is a new > compiler keyword, which is valid in this context, but has nothing to do with > the original problem. It demonstrates that GCC is happy to allocate an array of pure* using different syntax, and that the syntax works for declaring an automatic variable. > Anyway I believe this bug report should be closed before more people spend > time looking at C++ references for this. I disagree, it's a bug, and the code is accepted by other compilers.
next prev parent reply other threads:[~2010-10-31 11:31 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-32402-4@http.gcc.gnu.org/bugzilla/> 2010-10-28 17:21 ` redi at gcc dot gnu.org 2010-10-28 17:30 ` redi at gcc dot gnu.org 2010-10-28 17:44 ` redi at gcc dot gnu.org 2010-10-30 11:47 ` redi at gcc dot gnu.org 2010-10-31 7:34 ` mark at tibanne dot com 2010-10-31 11:31 ` redi at gcc dot gnu.org [this message] 2010-10-31 11:59 ` gcc at waisse dot org 2010-10-31 12:42 ` redi at gcc dot gnu.org 2014-08-10 8:47 ` paolo.carlini at oracle dot com 2007-06-19 14:45 [Bug c++/32402] New: " p dot vestjens at gmail dot com 2007-06-19 14:47 ` [Bug c++/32402] " p dot vestjens at gmail dot com 2007-11-12 15:06 ` gcc at waisse dot org 2007-11-12 15:42 ` gcc at waisse dot org 2007-11-12 19:41 ` zackw at panix dot com 2007-11-13 13:38 ` p dot vestjens at gmail dot com
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=20101031113100.dgvYoTLgs4UbwJHZOuwfZmtDSbpuPtRdIOarH1VBFJk@z \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).