Anders Carlsson | 14e82fd | 2011-02-06 18:31:40 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -O3 -o - | FileCheck %s |
| 2 | |
| 3 | // Check that we don't assert on this case. |
| 4 | namespace Test1 { |
| 5 | |
| 6 | struct Incomplete; |
| 7 | |
| 8 | struct A { |
| 9 | virtual void f(); |
| 10 | virtual void g(Incomplete); |
| 11 | virtual void h(); |
| 12 | virtual void i(); |
| 13 | int a; |
| 14 | }; |
| 15 | |
| 16 | struct B { |
| 17 | virtual void f(); |
| 18 | virtual void g(Incomplete); |
| 19 | virtual void h(); |
| 20 | virtual void i(); |
| 21 | int b; |
| 22 | }; |
| 23 | |
| 24 | struct C : A, B { |
| 25 | C(); |
| 26 | |
| 27 | virtual void f(); |
| 28 | virtual void g(Incomplete); |
| 29 | virtual void h(); |
| 30 | virtual void i(); |
| 31 | }; |
| 32 | |
| 33 | void C::h() { } |
| 34 | |
| 35 | C::C() { } |
| 36 | |
| 37 | void C::i() { } |
| 38 | |
| 39 | } |
| 40 | |
| 41 | namespace Test2 { |
| 42 | |
| 43 | struct A { |
| 44 | virtual void f(); |
| 45 | int a; |
| 46 | }; |
| 47 | |
| 48 | struct B { |
| 49 | virtual void f(); |
| 50 | int b; |
| 51 | }; |
| 52 | |
| 53 | struct C : A, B { |
| 54 | virtual void f(); |
| 55 | }; |
| 56 | |
| 57 | static void f(B* b) { |
| 58 | b->f(); |
| 59 | } |
| 60 | |
| 61 | // CHECK: define void @_ZN5Test21fEv() |
| 62 | // CHECK: call void @_ZN5Test21C1fEv |
| 63 | // CHECK: ret void |
| 64 | // CHECK: define available_externally void @_ZThn16_N5Test21C1fEv |
| 65 | void f() { |
| 66 | C c; |
| 67 | f(&c); |
| 68 | } |
| 69 | |
| 70 | } |
Anders Carlsson | 22df7b1 | 2011-02-06 20:09:44 +0000 | [diff] [blame] | 71 | |
| 72 | // Test that we don't assert. |
| 73 | namespace Test3 { |
| 74 | |
| 75 | struct A { |
| 76 | virtual ~A(); |
| 77 | |
| 78 | int a; |
| 79 | }; |
| 80 | |
| 81 | struct B : A { }; |
| 82 | struct C : virtual B { }; |
| 83 | |
| 84 | void f() { |
| 85 | C c; |
| 86 | } |
| 87 | |
| 88 | } |