[cfe-commits] r58866 - in /cfe/trunk: include/clang/AST/DeclBase.h include/clang/Basic/DiagnosticKinds.def lib/Parse/ParseDecl.cpp lib/Sema/SemaDecl.cpp test/SemaCXX/destructor.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Wed Nov 12 09:28:33 PST 2008

Mike Stump wrote:
> On Nov 11, 2008, at 3:19 PM, Sebastian Redl wrote:
>> Argiris Kirtzidis wrote:
>>> gcc compiles:
>>> class C : public B {
>>>  void m() {
>>>    this->~B();
>>>  }
>>> };
>>> Is this incorrect code ?
>> Yes, according to 5.2.4p2: "The type designated by the
>> pseudo-destructor-name shall be the same as the object type."
> I filed http://gcc.gnu.org/PR38087 just in case people are interested.
Hmm, seems I was too hasty there. ~B() here isn't a 
pseudo-destructor-name, because B is a class type, not a built-in type. 
Therefore, the whole section 5.2.4 doesn't apply.
The whole business of explicit destructor calls is an incredible mess. 
Look at these:

I still believe this is invalid according to 3.4.5p3 though:
  "At least one of the lookups shall find a name that refers to 
(possibly cv-qualified) T."
T is the type of the object expression, the object expression is the E 
in E.N or the *E in the interpretation of E->N as (*E).N


More information about the cfe-commits mailing list