Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s |
Fariborz Jahanian | abce699 | 2009-11-30 22:07:56 +0000 | [diff] [blame] | 2 | |
| 3 | struct basic_ios{~basic_ios(); }; |
| 4 | |
| 5 | template<typename _CharT> struct basic_istream : virtual public basic_ios { |
| 6 | virtual ~basic_istream(){} |
| 7 | }; |
| 8 | |
| 9 | template<typename _CharT> struct basic_iostream : public basic_istream<_CharT> |
| 10 | { |
| 11 | virtual ~basic_iostream(){} |
| 12 | }; |
| 13 | |
| 14 | basic_iostream<char> res; |
| 15 | |
| 16 | int main() { |
| 17 | } |
| 18 | |
John McCall | 3b47733 | 2010-02-18 19:59:28 +0000 | [diff] [blame] | 19 | // basic_iostream's complete dtor calls its base dtor, then its |
| 20 | // virtual base's dtor. |
Stephen Lin | 3258abc | 2013-06-19 23:23:19 +0000 | [diff] [blame^] | 21 | // CHECK: define linkonce_odr {{.*}} @_ZN14basic_iostreamIcED1Ev(%struct.basic_iostream* %this) unnamed_addr |
Eli Friedman | 12e9f8e | 2011-06-14 21:20:53 +0000 | [diff] [blame] | 22 | // CHECK: call {{.*}} @_ZN14basic_iostreamIcED2Ev |
| 23 | // CHECK: call {{.*}} @_ZN9basic_iosD2Ev |
John McCall | 3b47733 | 2010-02-18 19:59:28 +0000 | [diff] [blame] | 24 | |
Rafael Espindola | bbf58bb | 2010-03-10 02:19:29 +0000 | [diff] [blame] | 25 | // basic_iostream's base dtor calls its non-virtual base dtor. |
Stephen Lin | 3258abc | 2013-06-19 23:23:19 +0000 | [diff] [blame^] | 26 | // CHECK: define linkonce_odr {{.*}} @_ZN14basic_iostreamIcED2Ev(%struct.basic_iostream* %this, i8** %vtt) unnamed_addr |
Eli Friedman | 12e9f8e | 2011-06-14 21:20:53 +0000 | [diff] [blame] | 27 | // CHECK: call {{.*}} @_ZN13basic_istreamIcED2Ev |
Rafael Espindola | bbf58bb | 2010-03-10 02:19:29 +0000 | [diff] [blame] | 28 | // CHECK: } |
| 29 | |
John McCall | 3b47733 | 2010-02-18 19:59:28 +0000 | [diff] [blame] | 30 | // basic_iostream's deleting dtor calls its complete dtor, then |
| 31 | // operator delete(). |
Stephen Lin | 3258abc | 2013-06-19 23:23:19 +0000 | [diff] [blame^] | 32 | // CHECK: define linkonce_odr {{.*}} @_ZN14basic_iostreamIcED0Ev(%struct.basic_iostream* %this) unnamed_addr |
Eli Friedman | 12e9f8e | 2011-06-14 21:20:53 +0000 | [diff] [blame] | 33 | // CHECK: call {{.*}} @_ZN14basic_iostreamIcED1Ev |
| 34 | // CHECK: call {{.*}} @_ZdlPv |
John McCall | 3b47733 | 2010-02-18 19:59:28 +0000 | [diff] [blame] | 35 | |
| 36 | // basic_istream's complete dtor calls the base dtor, |
| 37 | // then its virtual base's base dtor. |
Stephen Lin | 3258abc | 2013-06-19 23:23:19 +0000 | [diff] [blame^] | 38 | // CHECK: define linkonce_odr {{.*}} @_ZN13basic_istreamIcED1Ev(%struct.basic_istream* %this) unnamed_addr |
Eli Friedman | 12e9f8e | 2011-06-14 21:20:53 +0000 | [diff] [blame] | 39 | // CHECK: call {{.*}} @_ZN13basic_istreamIcED2Ev |
| 40 | // CHECK: call {{.*}} @_ZN9basic_iosD2Ev |
John McCall | 3b47733 | 2010-02-18 19:59:28 +0000 | [diff] [blame] | 41 | |
| 42 | // basic_istream's deleting dtor calls the complete dtor, then |
| 43 | // operator delete(). |
Stephen Lin | 3258abc | 2013-06-19 23:23:19 +0000 | [diff] [blame^] | 44 | // CHECK: define linkonce_odr {{.*}} @_ZN13basic_istreamIcED0Ev(%struct.basic_istream* %this) unnamed_addr |
Eli Friedman | 12e9f8e | 2011-06-14 21:20:53 +0000 | [diff] [blame] | 45 | // CHECK: call {{.*}} @_ZN13basic_istreamIcED1Ev |
| 46 | // CHECK: call {{.*}} @_ZdlPv |
Anders Carlsson | e3d6cf2 | 2011-05-16 04:08:36 +0000 | [diff] [blame] | 47 | |
| 48 | // basic_istream's base dtor is a no-op. |
Stephen Lin | 3258abc | 2013-06-19 23:23:19 +0000 | [diff] [blame^] | 49 | // CHECK: define linkonce_odr {{.*}} @_ZN13basic_istreamIcED2Ev(%struct.basic_istream* %this, i8** %vtt) unnamed_addr |
Anders Carlsson | e3d6cf2 | 2011-05-16 04:08:36 +0000 | [diff] [blame] | 50 | // CHECK-NOT: call |
| 51 | // CHECK: } |