Topic: Type of a destructor reference in a class-member-access?
Author: "Johannes Schaub (litb)" <schaub-johannes@web.de>
Date: Sun, 7 Feb 2010 18:53:41 CST Raw View
What is the type of "x.~X" in n3000?
struct X {
~X();
};
int main() {
X x;
x.~X();
}
And what is the return type of the explicit destructor call? I don't find
where the Standard defines the type of the member "~X". Rules of 5.2.5/4
say: "If E2 is declared to have type `reference to T,` then E1.E2 is an
lvalue; the type of E1.E2 is T. Otherwise, one of the following rules
applies." However, no rules of the following bullets apply. In particular,
the rules for the non-static member functions say "... Otherwise, if E1.E2
refers to a non-static member function and the type of E2 is `function of
parameter-type-list cv ref-qualifier[opt] returning T`". However, 12.4 about
destructor functions doesn't say what the type of a destructor is.
And what is the type of the call "x.~X()"? I only see it defined for pseudo-
destructor-calls at 5.2.4 as "void".
--
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]