This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 110b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2023-01-15


1908. Dual destructor lookup and template-ids

Section: _N4868_.6.5.6  [basic.lookup.classref]     Status: CD6     Submitter: Hubert Tong     Date: 2014-03-31

[Accepted at the November, 2020 meeting as part of paper P1787R6 and moved to DR at the February, 2021 meeting.]

According to _N4868_.6.5.6 [basic.lookup.classref] paragraph 3,

If the unqualified-id is ~type-name, the type-name is looked up in the context of the entire postfix-expression. If the type T of the object expression is of a class type C, the type-name is also looked up in the scope of class C. At least one of the lookups shall find a name that refers to (possibly cv-qualified) T.

This would apply to an example like

  namespace K {
    template <typename T, typename U = char> struct A { };
    A<short> *a;
  }

  template <typename T> using A = K::A<short, T>;

  int main() {
    K::a->~A<char>();
  }

Current implementations, however, only apply the dual lookup when the type-name is not a template-id. The specification should be changed to reflect current practice.