blob: 8ef8aa7bb8648cc9ec1367ef2cd22a0145e6ec73 [file] [log] [blame]
David Blaikie6f1a2402013-06-20 17:23:30 +00001// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -emit-llvm -g %s -o - | FileCheck %s
Anders Carlssonba397fe2009-11-06 18:45:16 +00002template<typename T> struct Identity {
3 typedef T Type;
4};
5
6void f(Identity<int>::Type a) {}
Anders Carlssona031b352009-11-06 19:19:55 +00007void f(Identity<int> a) {}
8void f(int& a) { }
Anders Carlsson5b6117a2009-11-14 21:08:12 +00009
10template<typename T> struct A {
11 A<T> *next;
12};
13void f(A<int>) { }
Anders Carlsson20f12a22009-12-06 18:00:51 +000014
15struct B { };
16
17void f() {
18 int B::*a = 0;
19 void (B::*b)() = 0;
20}
Eli Friedman3364e622010-01-16 00:43:13 +000021
22namespace EmptyNameCrash {
23 struct A { A(); };
24 typedef struct { A x; } B;
25 B x;
26}
Anders Carlsson4433f1c2010-01-26 05:19:50 +000027
28// PR4890
29namespace PR4890 {
30 struct X {
31 ~X();
32 };
33
34 X::~X() { }
35}
36
37namespace VirtualDtor {
38 struct Y {
39 virtual ~Y();
40 };
41
42 Y::~Y() { }
43}
Anders Carlssone70d3912010-01-26 05:26:39 +000044
45namespace VirtualBase {
46 struct A { };
47 struct B : virtual A { };
48
49 void f() {
50 B b;
51 }
52}
Devang Patele5848d62010-08-23 18:26:10 +000053
54void foo() {
55 const wchar_t c = L'x';
56 wchar_t d = c;
57}
Nick Lewycky7803ec82011-09-01 21:49:51 +000058
59namespace b5249287 {
60template <typename T> class A {
61 struct B;
62};
63
64class Cls {
65 template <typename T> friend class A<T>::B;
66};
67
68Cls obj;
69}
David Blaikie0cd9ede2013-05-09 21:32:04 +000070
David Blaikie993b39f2013-06-05 18:30:31 +000071namespace pr14763 {
72struct foo {
73 foo(const foo&);
74};
75
76foo func(foo f) {
77 return f; // reference 'f' for now because otherwise we hit another bug
78}
79
Manman Renf1acc312013-08-29 18:51:51 +000080// CHECK: [[FOO:![0-9]*]] = metadata !{i32 {{[0-9]*}}, metadata !{{[0-9]*}}, metadata [[PR14763:![0-9]*]], {{.*}} ; [ DW_TAG_structure_type ] [foo]
81// CHECK: [[PR14763]] = {{.*}} ; [ DW_TAG_namespace ] [pr14763]
82// CHECK: [[INCTYPE:![0-9]*]] = {{.*}} ; [ DW_TAG_structure_type ] [incomplete]{{.*}} [decl]
83// CHECK: metadata [[A_MEM:![0-9]*]], i32 0, null, null, metadata !"_ZTSN7pr162141aE"} ; [ DW_TAG_structure_type ] [a]
84// CHECK: [[A_MEM]] = metadata !{metadata [[A_I:![0-9]*]]}
85// CHECK: [[A_I]] = {{.*}} ; [ DW_TAG_member ] [i] {{.*}} [from int]
86// CHECK: ; [ DW_TAG_structure_type ] [b] {{.*}}[decl]
87
David Blaikie993b39f2013-06-05 18:30:31 +000088// CHECK: [[FUNC:![0-9]*]] = {{.*}} metadata !"_ZN7pr147634funcENS_3fooE", i32 {{[0-9]*}}, metadata [[FUNC_TYPE:![0-9]*]], {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [def] [func]
David Blaikie993b39f2013-06-05 18:30:31 +000089}
90
David Blaikie0cd9ede2013-05-09 21:32:04 +000091namespace pr9608 { // also pr9600
92struct incomplete;
93incomplete (*x)[3];
94// CHECK: metadata [[INCARRAYPTR:![0-9]*]], i32 0, i32 1, [3 x i8]** @_ZN6pr96081xE, null} ; [ DW_TAG_variable ] [x]
95// CHECK: [[INCARRAYPTR]] = {{.*}}metadata [[INCARRAY:![0-9]*]]} ; [ DW_TAG_pointer_type ]
Manman Renf1acc312013-08-29 18:51:51 +000096// CHECK: [[INCARRAY]] = {{.*}}metadata [[INCTYPE]], metadata {{![0-9]*}}, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 0, align 0, offset 0] [from incomplete]
David Blaikie0cd9ede2013-05-09 21:32:04 +000097}
David Blaikie5f6e2f42013-06-05 05:32:23 +000098
David Blaikie993b39f2013-06-05 18:30:31 +000099// For some reason the argument for PR14763 ended up all the way down here
David Blaikie6f1a2402013-06-20 17:23:30 +0000100// CHECK: = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], {{.*}}, metadata [[FOO]], i32 8192, i32 0} ; [ DW_TAG_arg_variable ] [f]
David Blaikie993b39f2013-06-05 18:30:31 +0000101
David Blaikie5f6e2f42013-06-05 05:32:23 +0000102namespace pr16214 {
103struct a {
104 int i;
105};
106
107typedef a at;
108
109struct b {
110};
111
112typedef b bt;
113
114void func() {
115 at a_inst;
116 bt *b_ptr_inst;
117 const bt *b_cnst_ptr_inst;
118}
119
David Blaikie5f6e2f42013-06-05 05:32:23 +0000120}