David Blaikie | 6f1a240 | 2013-06-20 17:23:30 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-none-linux-gnu -emit-llvm -g %s -o - | FileCheck %s |
Anders Carlsson | ba397fe | 2009-11-06 18:45:16 +0000 | [diff] [blame] | 2 | template<typename T> struct Identity { |
| 3 | typedef T Type; |
| 4 | }; |
| 5 | |
| 6 | void f(Identity<int>::Type a) {} |
Anders Carlsson | a031b35 | 2009-11-06 19:19:55 +0000 | [diff] [blame] | 7 | void f(Identity<int> a) {} |
| 8 | void f(int& a) { } |
Anders Carlsson | 5b6117a | 2009-11-14 21:08:12 +0000 | [diff] [blame] | 9 | |
| 10 | template<typename T> struct A { |
| 11 | A<T> *next; |
| 12 | }; |
| 13 | void f(A<int>) { } |
Anders Carlsson | 20f12a2 | 2009-12-06 18:00:51 +0000 | [diff] [blame] | 14 | |
| 15 | struct B { }; |
| 16 | |
| 17 | void f() { |
| 18 | int B::*a = 0; |
| 19 | void (B::*b)() = 0; |
| 20 | } |
Eli Friedman | 3364e62 | 2010-01-16 00:43:13 +0000 | [diff] [blame] | 21 | |
| 22 | namespace EmptyNameCrash { |
| 23 | struct A { A(); }; |
| 24 | typedef struct { A x; } B; |
| 25 | B x; |
| 26 | } |
Anders Carlsson | 4433f1c | 2010-01-26 05:19:50 +0000 | [diff] [blame] | 27 | |
| 28 | // PR4890 |
| 29 | namespace PR4890 { |
| 30 | struct X { |
| 31 | ~X(); |
| 32 | }; |
| 33 | |
| 34 | X::~X() { } |
| 35 | } |
| 36 | |
| 37 | namespace VirtualDtor { |
| 38 | struct Y { |
| 39 | virtual ~Y(); |
| 40 | }; |
| 41 | |
| 42 | Y::~Y() { } |
| 43 | } |
Anders Carlsson | e70d391 | 2010-01-26 05:26:39 +0000 | [diff] [blame] | 44 | |
| 45 | namespace VirtualBase { |
| 46 | struct A { }; |
| 47 | struct B : virtual A { }; |
| 48 | |
| 49 | void f() { |
| 50 | B b; |
| 51 | } |
| 52 | } |
Devang Patel | e5848d6 | 2010-08-23 18:26:10 +0000 | [diff] [blame] | 53 | |
| 54 | void foo() { |
| 55 | const wchar_t c = L'x'; |
| 56 | wchar_t d = c; |
| 57 | } |
Nick Lewycky | 7803ec8 | 2011-09-01 21:49:51 +0000 | [diff] [blame] | 58 | |
| 59 | namespace b5249287 { |
| 60 | template <typename T> class A { |
| 61 | struct B; |
| 62 | }; |
| 63 | |
| 64 | class Cls { |
| 65 | template <typename T> friend class A<T>::B; |
| 66 | }; |
| 67 | |
| 68 | Cls obj; |
| 69 | } |
David Blaikie | 0cd9ede | 2013-05-09 21:32:04 +0000 | [diff] [blame] | 70 | |
David Blaikie | 993b39f | 2013-06-05 18:30:31 +0000 | [diff] [blame] | 71 | namespace pr14763 { |
| 72 | struct foo { |
| 73 | foo(const foo&); |
| 74 | }; |
| 75 | |
| 76 | foo func(foo f) { |
| 77 | return f; // reference 'f' for now because otherwise we hit another bug |
| 78 | } |
| 79 | |
| 80 | // CHECK: [[FUNC:![0-9]*]] = {{.*}} metadata !"_ZN7pr147634funcENS_3fooE", i32 {{[0-9]*}}, metadata [[FUNC_TYPE:![0-9]*]], {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [def] [func] |
| 81 | // CHECK: [[PR14763:![0-9]*]] = {{.*}} ; [ DW_TAG_namespace ] [pr14763] |
| 82 | // CHECK: [[FOO:![0-9]*]] = metadata !{i32 {{[0-9]*}}, metadata !{{[0-9]*}}, metadata [[PR14763]], {{.*}} ; [ DW_TAG_structure_type ] [foo] |
| 83 | } |
| 84 | |
David Blaikie | 0cd9ede | 2013-05-09 21:32:04 +0000 | [diff] [blame] | 85 | namespace pr9608 { // also pr9600 |
| 86 | struct incomplete; |
| 87 | incomplete (*x)[3]; |
| 88 | // CHECK: metadata [[INCARRAYPTR:![0-9]*]], i32 0, i32 1, [3 x i8]** @_ZN6pr96081xE, null} ; [ DW_TAG_variable ] [x] |
| 89 | // CHECK: [[INCARRAYPTR]] = {{.*}}metadata [[INCARRAY:![0-9]*]]} ; [ DW_TAG_pointer_type ] |
| 90 | // CHECK: [[INCARRAY]] = {{.*}}metadata [[INCTYPE:![0-9]*]], metadata {{![0-9]*}}, i32 0, i32 0} ; [ DW_TAG_array_type ] [line 0, size 0, align 0, offset 0] [from incomplete] |
David Blaikie | 09a5604 | 2013-06-21 03:41:46 +0000 | [diff] [blame^] | 91 | // CHECK: [[INCTYPE]] = {{.*}} ; [ DW_TAG_structure_type ] [incomplete]{{.*}} [decl] |
David Blaikie | 0cd9ede | 2013-05-09 21:32:04 +0000 | [diff] [blame] | 92 | } |
David Blaikie | 5f6e2f4 | 2013-06-05 05:32:23 +0000 | [diff] [blame] | 93 | |
David Blaikie | 993b39f | 2013-06-05 18:30:31 +0000 | [diff] [blame] | 94 | // For some reason the argument for PR14763 ended up all the way down here |
David Blaikie | 6f1a240 | 2013-06-20 17:23:30 +0000 | [diff] [blame] | 95 | // CHECK: = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], {{.*}}, metadata [[FOO]], i32 8192, i32 0} ; [ DW_TAG_arg_variable ] [f] |
David Blaikie | 993b39f | 2013-06-05 18:30:31 +0000 | [diff] [blame] | 96 | |
David Blaikie | 5f6e2f4 | 2013-06-05 05:32:23 +0000 | [diff] [blame] | 97 | namespace pr16214 { |
| 98 | struct a { |
| 99 | int i; |
| 100 | }; |
| 101 | |
| 102 | typedef a at; |
| 103 | |
| 104 | struct b { |
| 105 | }; |
| 106 | |
| 107 | typedef b bt; |
| 108 | |
| 109 | void func() { |
| 110 | at a_inst; |
| 111 | bt *b_ptr_inst; |
| 112 | const bt *b_cnst_ptr_inst; |
| 113 | } |
| 114 | |
| 115 | // CHECK: metadata [[A_MEM:![0-9]*]], i32 0, null, null} ; [ DW_TAG_structure_type ] [a] |
| 116 | // CHECK: [[A_MEM]] = metadata !{metadata [[A_I:![0-9]*]], metadata !{{[0-9]*}}} |
| 117 | // CHECK: [[A_I]] = {{.*}} ; [ DW_TAG_member ] [i] {{.*}} [from int] |
David Blaikie | 09a5604 | 2013-06-21 03:41:46 +0000 | [diff] [blame^] | 118 | // CHECK: ; [ DW_TAG_structure_type ] [b] {{.*}}[decl] |
David Blaikie | 5f6e2f4 | 2013-06-05 05:32:23 +0000 | [diff] [blame] | 119 | } |