// RUN: %clang_cc1 -std=c++11 -triple aarch64-none-linux-android21 -fclangir -emit-cir %s -o %t.cir // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s struct Flub { int a = 123; // CIR: @_ZN4FlubC1ERKS_(%arg0: !cir.ptr loc({{.*}}), %arg1: !cir.ptr loc({{.*}})) special_member<#cir.cxx_ctor> // CIR: @_ZN4FlubC2EOS_(%arg0: !cir.ptr loc({{.*}}), %arg1: !cir.ptr loc({{.*}})) special_member<#cir.cxx_ctor // CIR: @_ZN4FlubaSERKS_(%arg0: !cir.ptr loc({{.*}}), %arg1: !cir.ptr loc({{.*}})) -> !cir.ptr special_member<#cir.cxx_assign> // CIR: @_ZN4FlubaSEOS_(%arg0: !cir.ptr loc({{.*}}), %arg1: !cir.ptr loc({{.*}})) -> !cir.ptr special_member<#cir.cxx_assign> }; struct Foo { int a; // CIR: @_ZN3FooC2Ev(%arg0: !cir.ptr loc({{.*}})) special_member<#cir.cxx_ctor> Foo() : a(123) {} // CIR: @_ZN3FooC2ERKS_(%arg0: !cir.ptr loc({{.*}}), %arg1: !cir.ptr loc({{.*}})) special_member<#cir.cxx_ctor> Foo(const Foo &other) : a(other.a) {} // CIR: @_ZN3FooC2EOS_(%arg0: !cir.ptr loc({{.*}}), %arg1: !cir.ptr loc({{.*}})) special_member<#cir.cxx_ctor> Foo(Foo &&other) noexcept : a(other.a) { other.a = 0; } // CIR: @_ZN3FooaSERKS_(%arg0: !cir.ptr loc({{.*}}), %arg1: !cir.ptr loc({{.*}})) -> !cir.ptr special_member<#cir.cxx_assign> Foo &operator=(const Foo &other) { if (this != &other) { a = other.a; } return *this; } // CIR: @_ZN3FooaSEOS_(%arg0: !cir.ptr loc({{.*}}), %arg1: !cir.ptr loc({{.*}})) -> !cir.ptr special_member<#cir.cxx_assign> Foo &operator=(Foo &&other) noexcept { if (this != &other) { a = other.a; other.a = 0; } return *this; } // CIR: @_ZN3FooD1Ev(!cir.ptr) special_member<#cir.cxx_dtor> ~Foo(); }; void trivial() { Flub f1{}; Flub f2 = f1; Flub f3 = static_cast(f1); f2 = f1; f1 = static_cast(f3); } void non_trivial() { Foo f1{}; Foo f2 = f1; Foo f3 = static_cast(f1); f2 = f1; f1 = static_cast(f3); }