xref: /llvm-project/clang/test/CodeGenCXX/gh62818.cpp (revision 2a23de01e51545d01055229baea4d4a296b65058)
1*2a23de01SShafik Yaghmour // RUN: %clang_cc1 -std=c++17 -emit-llvm -triple x86_64-linux-gnu -o - %s | FileCheck %s
2*2a23de01SShafik Yaghmour 
3*2a23de01SShafik Yaghmour void doSomething();
4*2a23de01SShafik Yaghmour 
5*2a23de01SShafik Yaghmour struct A {
AA6*2a23de01SShafik Yaghmour   A() {};
~AA7*2a23de01SShafik Yaghmour   ~A() noexcept {
8*2a23de01SShafik Yaghmour     doSomething();
9*2a23de01SShafik Yaghmour   }
10*2a23de01SShafik Yaghmour 
operator =A11*2a23de01SShafik Yaghmour   A & operator=(A a) & noexcept {
12*2a23de01SShafik Yaghmour     return *this;
13*2a23de01SShafik Yaghmour   }
14*2a23de01SShafik Yaghmour };
15*2a23de01SShafik Yaghmour 
16*2a23de01SShafik Yaghmour template<typename T>
17*2a23de01SShafik Yaghmour struct B {
testB18*2a23de01SShafik Yaghmour   void test() {a = {};}
19*2a23de01SShafik Yaghmour   // CHECK: define linkonce_odr void @_ZN1BIiE4testEv
20*2a23de01SShafik Yaghmour   // CHECK: call void @_ZN1AC1Ev(ptr noundef nonnull align 1 dereferenceable(1)
21*2a23de01SShafik Yaghmour   // CHECK: [[CALL:%.*]] = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNR1AaSES_
22*2a23de01SShafik Yaghmour   // CHECK: call void @_ZN1AD2Ev(ptr noundef nonnull align 1 dereferenceable(1)
23*2a23de01SShafik Yaghmour 
24*2a23de01SShafik Yaghmour   A a;
25*2a23de01SShafik Yaghmour };
26*2a23de01SShafik Yaghmour 
client(B<int> & f)27*2a23de01SShafik Yaghmour void client(B<int> &f) {f.test();}
28