This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114b. See for the official list.


2250. Implicit instantiation, destruction, and TUs

Section:  [temp.point]     Status: open     Submitter: Dawn Perchik     Date: 2016-03-21


  template<class T> struct A {
    T* p;
    ~A() {
	if (0 < sizeof (T))
	  delete p;
  struct U;
  struct 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.

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.