xref: /llvm-project/clang/test/CodeGenCXX/ms-inheriting-ctor.cpp (revision 1d0bd8e51be2627f79bede54735c38b917ea04ee)
1 // RUN: %clang_cc1 -fcxx-exceptions -triple=x86_64-windows-msvc -emit-llvm %s -o - | FileCheck %s
2 
3 class F {
4 public:
5   F(wchar_t *);
6 };
7 using a = F;
8 struct A {};
9 struct b {
10   b(a, F, A);
11 };
12 template <typename, typename> struct c : b {
cc13   c(const a &p1, const A &d) : b(p1, 0, d) {}
14 };
15 template <typename e> struct B : c<e, b> {
16   using c<e, b>::c;
17 };
18 class f {
19 public:
20   f(...);
21 }
22 
23 typedef g;
24 class C {
25 public:
26   C(g, f);
27 };
28 static wchar_t h;
29 class D {
30 public:
31   static C E();
32 };
33 
E()34 C D::E() {
35   C i(B<bool>(&h, {}), f());
36   return i;
37 }
38 
39 // Inheriting ctor has internal linkage without comdat.
40 
41 // CHECK-LABEL: define internal noundef ptr @"??0?$B@_N@@QEAA@AEBVF@@AEBUA@@@Z"
42 // CHECK-NOT:comdat
43 // CHECK-SAME: {{\{$}}
44 
45 // non-inheriting ctro should has linkonce_odr with comdat attribute.
46 
47 // CHECK-LABEL: define linkonce_odr dso_local noundef ptr @"??0?$c@_NUb@@@@QEAA@AEBVF@@AEBUA@@@Z"
48 // CHECK:comdat
49 // CHECK-SAME: {{\{$}}
50