public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21603] New: C++ front-end accepts "new" with VLAs
@ 2005-05-16  2:17 mmitchel at gcc dot gnu dot org
  2005-05-16 20:28 ` [Bug c++/21603] " jason at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-05-16  2:17 UTC (permalink / raw)
  To: gcc-bugs

All three lines marked with comments in:

void f(int n) {
  typedef int T[n][n];
  new int[n][n]; // #1                                                          
  new (int[n][n]); // #2                                                        
  new T; // #3                                                                  
}

are invalid, but only the first receives an error without -pedantic.

That's an inconsistency; either we should allow all, or none, of the
declarations.  Which should it be?

Steve Adamczyk has indicated that he feels that permitting dynamic allocation of
VLAs is a mistake, in that, for example, you can't easily use the pointer
outside the scope of the containing function, unless you somehow also pass/save
the bounds.

-- 
           Summary: C++ front-end accepts "new" with VLAs
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mmitchel at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,jason at redhat dot
                    com,nathan at codesourcery dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21603


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/21603] C++ front-end accepts "new" with VLAs
  2005-05-16  2:17 [Bug c++/21603] New: C++ front-end accepts "new" with VLAs mmitchel at gcc dot gnu dot org
@ 2005-05-16 20:28 ` jason at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: jason at redhat dot com @ 2005-05-16 20:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jason at redhat dot com  2005-05-16 20:28 -------
Subject: Re:  New: C++ front-end accepts "new" with VLAs

On 16 May 2005 02:16:51 -0000, "mmitchel at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> wrote:

> Steve Adamczyk has indicated that he feels that permitting dynamic allocation of
> VLAs is a mistake, in that, for example, you can't easily use the pointer
> outside the scope of the containing function, unless you somehow also pass/save
> the bounds.

Makes sense to me.

Jason


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21603


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-16 20:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-16  2:17 [Bug c++/21603] New: C++ front-end accepts "new" with VLAs mmitchel at gcc dot gnu dot org
2005-05-16 20:28 ` [Bug c++/21603] " jason at redhat dot com

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).