reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s

template<typename A> class s0 {

  template<typename B> class s1 : public s0<A> {
    ~s1() {}
    s0<A> ms0;
  };

};

struct Incomplete;

template<typename T>
void destroy_me(T me) {
  me.~T();
}

template void destroy_me(Incomplete*);

namespace PR6152 {
  template<typename T> struct X { void f(); };
  template<typename T> struct Y { };
  template<typename T>
  void X<T>::f() {
    Y<T> *y;
    y->template Y<T>::~Y();
    y->template Y<T>::~Y<T>();
    y->~Y();
  }
  
  template struct X<int>;
}

namespace cvquals {
  template<typename T>
  void f(int *ptr) {
    ptr->~T();
  }

  template void f<const volatile int>(int *);
}

namespace PR7239 {
  template<class E> class A { };
  class B {
    void f() {
      A<int>* x;
      x->A<int>::~A<int>();
    }
  };
}

namespace PR7904 {
  struct Foo {};
  template <class T>
  Foo::~Foo() { // expected-error{{destructor cannot be declared as a template}}
    T t;
    T &pT = t;
    pT;
  }
  Foo f;
}

namespace rdar13140795 {
  template <class T> class shared_ptr {};

  template <typename T> struct Marshal {
    static int gc();
  };


  template <typename T> int Marshal<T>::gc() {
    shared_ptr<T> *x;
    x->template shared_ptr<T>::~shared_ptr();
    return 0;
  }

  void test() {
    Marshal<int>::gc();
  }
}

namespace PR16852 {
  template<typename T> struct S { int a; T x; };
  template<typename T> decltype(S<T>().~S()) f(); // expected-note {{candidate template ignored: couldn't infer template argument 'T'}}
  void g() { f(); } // expected-error {{no matching function for call to 'f'}}
}

class PR33189
{
  template <class T>
  ~PR33189() { } // expected-error{{destructor cannot be declared as a template}}
};