public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Possible minor g++ 3.4 issue
@ 2004-02-17  6:50 Dan Olson
  2004-02-18  3:58 ` Jim Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Olson @ 2004-02-17  6:50 UTC (permalink / raw)
  To: gcc-bugs

Hi,

I'm not sure of the standard's position on the following code:

int main ()
{
   unsigned char *buffer = new (unsigned char)[1024];

   delete [] buffer;
}

3.3 versions of g++ accept this code without complaint, but 3.4 gives
the message:

test.cpp:3: error: expected `,' or `;' before '[' token

Changing the code to the more "normal"

unsigned char *buffer = new unsigned char[1024];

fixes the compilation error, but I'm wondering if 3.4 is correct in
rejecting this code.

Thank you

-- 
Dan Olson


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

* Re: Possible minor g++ 3.4 issue
  2004-02-17  6:50 Possible minor g++ 3.4 issue Dan Olson
@ 2004-02-18  3:58 ` Jim Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 2004-02-18  3:58 UTC (permalink / raw)
  To: dan; +Cc: gcc-bugs

Dan Olson wrote:
>    unsigned char *buffer = new (unsigned char)[1024];
> 3.3 versions of g++ accept this code without complaint, but 3.4 gives
> the message:
> test.cpp:3: error: expected `,' or `;' before '[' token

This was covered in a recent thread on the gcc list.
	http://gcc.gnu.org/ml/gcc/2004-02/msg00970.html
	http://gcc.gnu.org/ml/gcc/2004-02/msg00974.html

This is not valid C++.  Earlier g++ versions accepted it, but g++ now 
correctly rejects it, as we are trying to make g++ conform better to the 
  C++ standard.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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

end of thread, other threads:[~2004-02-18  3:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-17  6:50 Possible minor g++ 3.4 issue Dan Olson
2004-02-18  3:58 ` Jim Wilson

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