xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/trivial-constructor-init.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s -o - -std=c++11 -triple %itanium_abi_triple | FileCheck %s
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc extern "C" int printf(...);
4f4a2713aSLionel Sambuc 
5f4a2713aSLionel Sambuc struct S {
SS6f4a2713aSLionel Sambuc   S() { printf("S::S\n"); }
7f4a2713aSLionel Sambuc };
8f4a2713aSLionel Sambuc 
9f4a2713aSLionel Sambuc struct A {
10f4a2713aSLionel Sambuc   double x;
AA11f4a2713aSLionel Sambuc   A() : x(), y(), s() { printf("x = %f y = %x \n", x, y); }
12f4a2713aSLionel Sambuc   int *y;
13f4a2713aSLionel Sambuc   S s;
14f4a2713aSLionel Sambuc };
15f4a2713aSLionel Sambuc 
16f4a2713aSLionel Sambuc A a;
17f4a2713aSLionel Sambuc 
18f4a2713aSLionel Sambuc struct B {
19f4a2713aSLionel Sambuc   B() = default;
20f4a2713aSLionel Sambuc   B(const B&);
21f4a2713aSLionel Sambuc };
22f4a2713aSLionel Sambuc 
23f4a2713aSLionel Sambuc // CHECK-NOT: _ZL1b
24f4a2713aSLionel Sambuc static B b;
25f4a2713aSLionel Sambuc 
26f4a2713aSLionel Sambuc struct C {
27f4a2713aSLionel Sambuc   ~C();
28f4a2713aSLionel Sambuc };
29f4a2713aSLionel Sambuc 
30f4a2713aSLionel Sambuc // CHECK: _ZL1c
31f4a2713aSLionel Sambuc static C c[4];
32f4a2713aSLionel Sambuc 
main()33f4a2713aSLionel Sambuc int main() {
34f4a2713aSLionel Sambuc }
35*0a6a1f1dSLionel Sambuc 
36*0a6a1f1dSLionel Sambuc namespace PR22793 {
37*0a6a1f1dSLionel Sambuc template <typename>
38*0a6a1f1dSLionel Sambuc struct foo {
39*0a6a1f1dSLionel Sambuc protected:
40*0a6a1f1dSLionel Sambuc // CHECK-NOT: _ZN7PR227933fooIiED2Ev
41*0a6a1f1dSLionel Sambuc   ~foo() = default;
42*0a6a1f1dSLionel Sambuc   friend void func();
43*0a6a1f1dSLionel Sambuc };
44*0a6a1f1dSLionel Sambuc 
func()45*0a6a1f1dSLionel Sambuc void func() { foo<int> f; }
46*0a6a1f1dSLionel Sambuc 
47*0a6a1f1dSLionel Sambuc template struct foo<int>;
48*0a6a1f1dSLionel Sambuc }
49