[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-bugs
Subject: operator new with placement
From: Carlo Wood <carlo () runaway ! xs4all ! nl>
Date: 1999-10-12 0:01:36
[Download RAW message or body]
Hiya,
I deperately need new with placement, but gcc-2.95.1 refuses
to compile it.
The (latest draft) standard that I got says:
18.4.1.3 Placement forms [lib.new.delete.placement]
1 These functions are reserved, a C++ program may not define functions
that displace the versions in the Standard C++ library (_lib.con-
straints_).
void* operator new(std::size_t size, void* ptr) throw();
Returns:
ptr.
Notes:
Intentionally performs no other action.
2 [Example: This can be useful for constructing an object at a known
address:
char place[sizeof(Something)];
Something* p = new (place) Something();
--end example]
But when I try to compile this:
--------------------------
class Something {
};
char place[sizeof(Something)];
int main(void)
{
Something* p = new (place) Something();
return 0;
}
--------------------------
I get:
--------------------------
~/c++/tests>g++ placement.cc
placement.cc: In function `int main()':
<internal>:8: too many arguments to function `void * operator new(unsigned int)'
placement.cc:8: at this point in file
Bug? Or did the standard change since the draft I got?
--
Carlo Wood <carlo@runaway.xs4all.nl>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic