This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/18901] Type of 'new (T*) [n]'


------- Additional Comments From wolfgang dot roehrl at de dot gi-de dot com  2004-12-09 16:15 -------
Subject: Antwort:  Type of 'new (T*) [n]'





Hi all,

I am responding to the Comments From giovannibajo at libero dot it
2004-12-09 12:59 (Bug report 18901):

The expression 'new (int*)[3]' is NOT an array-new. It simply allocates a
int*, i.e. a pointer to an int. So new returns a pointer to a pointer to an
int, which in turn is is derefenced by [3] and we get a pointer to an int.
The latter operation is _semantically_ illegal because we didn't allocate
an array of pointers to ints.
But my point is that the _type_ of  'new (int*)[3]' is int* and function
f1() should be called.

And I think the code fragment woud be valid if we wrote  'new (int*)[0]'
instead of  'new (int*)[3]'.

W. Roehrl



-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]