Title
Implicit instantiation, destruction, and TUs
Status
open
Section
13.8.4.1 [temp.point]
Submitter
Dawn Perchik

Created on 2016-03-21.00:00:00 last changed 87 months ago

Messages

Date: 2016-12-15.00:00:00

Notes from the December, 2016 teleconference:

The problem is that the current wording only connects name lookup with point of instantiation; other semantic checks, such as the requirement for completeness of a class, should also be performed at that point.

Date: 2022-02-18.07:47:23

Consider:

  template<class T> struct A {
    T* p;
    A();
    ~A() {
	if (0 < sizeof (T))
	  delete p;
    }
  };
  struct U;
  struct C {
    C();
    ~C();
    A<U> u;
  };
  int main() {
    C c;
    return 0;
  }

The intent is that A<U>::~A is instantiated where the special member functions of C are defined (at which point U is ostensibly complete). Preventing instantiation (and thus avoiding the completeness check) in the present translation unit is necessary for the unique_ptr-based pimpl idiom to work.

History
Date User Action Args
2017-02-06 00:00:00adminsetmessages: + msg5836
2016-03-21 00:00:00admincreate