Multiple types found on destructor lookup
_N4868_.6.5.6 [basic.lookup.classref]
John Spicer

Created on 2003-05-01.00:00:00 last changed 161 months ago


Date: 2006-10-15.00:00:00

[Voted into WP at the October, 2006 meeting.]

Date: 2005-04-15.00:00:00

Proposed resolution (April, 2005):

This issue is resolved by the resolution of issue 305.

Date: 2021-02-24.00:00:00

By _N4868_.6.5.6 [basic.lookup.classref] paragraph 3, the following is ill-formed because the two lookups of the destructor name (in the scope of the class of the object and in the surrounding context) find different Xs:

  struct X {};
  int main() {
    X x;
    struct X {};
    x.~X();  // Error?

This is silly, because the compiler knows what the type has to be, and one of the things found matches that. The lookup should require only that one of the lookups finds the required class type.

Date User Action Args
2008-10-05 00:00:00adminsetstatus: wp -> cd1
2007-05-06 00:00:00adminsetstatus: dr -> wp
2006-11-05 00:00:00adminsetmessages: + msg1429
2006-11-05 00:00:00adminsetstatus: ready -> dr
2006-04-22 00:00:00adminsetstatus: review -> ready
2005-05-01 00:00:00adminsetmessages: + msg1141
2005-05-01 00:00:00adminsetstatus: drafting -> review
2004-04-09 00:00:00adminsetstatus: open -> drafting
2003-05-01 00:00:00admincreate