[Bug c++/12238] placement delete not called on incomplete object construction if in try-block!

giovannibajo at libero dot it gcc-bugzilla@gcc.gnu.org
Wed Oct 6 23:56:00 GMT 2004


------- Additional Comments From giovannibajo at libero dot it  2004-10-06 23:56 -------
The point is: if there is an exception while constructing an object in a 
placement new expression, a placement deallocation function is called if and 
only if it is found by lookup, and the lookup is not ambiguous. The standard is 
pretty clear that if no function is found, then nothing is done. See 
[expr.new]/17 and /19.

There is nothing we can do about this. If the user declares a wrong function, 
it is his fault. There are situations where the user wants to *not* declare a 
deallocation function because it is useless. For instance, in the example in 
comment #4, memory from a static pool is returned in the placement allocation 
function, so there is nothing to be done to free it: in this case, the user has 
very good rights to not declare a placement deallocation function and not get a 
wrong warning about it.

There is no bug in this PR, and I cannot see a way to improve the diagnostic 
either (so not even a QoI issue). Thus, I'm closing this as invalid.



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giovannibajo at libero dot
                   |                            |it
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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



More information about the Gcc-bugs mailing list