C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Defect Report: deallocation function look-up and resolution

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Mon Nov 27, 2006 3:49 pm    Post subject: Defect Report: deallocation function look-up and resolution Reply with quote



C++03, 12.5/4 says:

Quote:

If a delete-expression begins with a unary :: operator, the
deallocation function's name is looked up in global scope. Otherwise,
if the delete-expression is used to deallocate a class object whose
static type has a virtual destructor, the deallocation function is the
one found by the lookup in the definition of the dynamic type's
virtual destructor (12.4).104) [...]. If this lookup fails to find the
name, the name is looked up in the global scope. *If the result of the
lookup is ambiguous or inaccessible, or if the lookup selects a
placement deallocation function, the program is ill-formed*.


It's not clear how the name lookup is done. Is it through overload
resolution? If it is, how is the candidate set formed? If it's not,
then does that mean only the non-placement deallocation function is
looked up or what?

In particular, whether the example below is ill-formed is left
unanswered:

struct S
{
void operator delete(void*);
void operator delete(void*, size_t);
};

S* ps = ...;
delete ps; // ambiguous?

I see that Core language Issue 255 essentially stated the same
question, but the suggested answer is still confusing:

Quote:

I think you might get the right effect by replacing the last sentence
of 12.5 class.free paragraph 4 with something like:
After removing all placement deallocation functions, the result of
the lookup shall contain an unambiguous and accessible deallocation
function.


The problem is, after removing all placement deallocation functions,
there should be only one usual(non-placement) deallocation function
left( 3.7.3.2/2 clearly indicates that there could be only one
usual(non-placement) deallocation function, which is either operator
delete(void*), or operator delete(void*, size_t) if the previous one
isn't declared), so how could there be any ambiguity?

[Note that the existence of operator delete(void*) will make operator
delete(void*, size_t) a placement deallocation function, thus being
removed from the lookup set.

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.