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