1// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
2
3struct basic_ios{~basic_ios(); };
4
5template<typename _CharT> struct basic_istream : virtual public basic_ios {
6  virtual ~basic_istream(){}
7};
8
9template<typename _CharT> struct basic_iostream : public basic_istream<_CharT>
10{
11  virtual ~basic_iostream(){}
12};
13
14basic_iostream<char> res;
15
16int main() {
17}
18
19// basic_iostream's complete dtor calls its base dtor, then its
20// virtual base's dtor.
21//  CHECK: define linkonce_odr {{.*}} @_ZN14basic_iostreamIcED1Ev(%struct.basic_iostream* %this) unnamed_addr
22//  CHECK: call {{.*}} @_ZN14basic_iostreamIcED2Ev
23//  CHECK: call {{.*}} @_ZN9basic_iosD2Ev
24
25// basic_iostream's base dtor calls its non-virtual base dtor.
26//  CHECK: define linkonce_odr {{.*}} @_ZN14basic_iostreamIcED2Ev(%struct.basic_iostream* %this, i8** %vtt) unnamed_addr
27//  CHECK: call {{.*}} @_ZN13basic_istreamIcED2Ev
28//  CHECK: }
29
30// basic_iostream's deleting dtor calls its complete dtor, then
31// operator delete().
32//  CHECK: define linkonce_odr {{.*}} @_ZN14basic_iostreamIcED0Ev(%struct.basic_iostream* %this) unnamed_addr
33//  CHECK: call {{.*}} @_ZN14basic_iostreamIcED1Ev
34//  CHECK: call {{.*}} @_ZdlPv
35
36// basic_istream's complete dtor calls the base dtor,
37// then its virtual base's base dtor.
38//  CHECK: define linkonce_odr {{.*}} @_ZN13basic_istreamIcED1Ev(%struct.basic_istream* %this) unnamed_addr
39//  CHECK: call {{.*}} @_ZN13basic_istreamIcED2Ev
40//  CHECK: call {{.*}} @_ZN9basic_iosD2Ev
41
42// basic_istream's deleting dtor calls the complete dtor, then
43// operator delete().
44//  CHECK: define linkonce_odr {{.*}} @_ZN13basic_istreamIcED0Ev(%struct.basic_istream* %this) unnamed_addr
45//  CHECK: call {{.*}} @_ZN13basic_istreamIcED1Ev
46//  CHECK: call {{.*}} @_ZdlPv
47
48// basic_istream's base dtor is a no-op.
49//  CHECK: define linkonce_odr {{.*}} @_ZN13basic_istreamIcED2Ev(%struct.basic_istream* %this, i8** %vtt) unnamed_addr
50//  CHECK-NOT: call
51//  CHECK: }
52