[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / assign-operator.cpp
blob1bc168aecef075cb23446d61113553ffdecc0f88
1 // RUN: %clang_cc1 -no-opaque-pointers %s -triple x86_64-apple-darwin10 -emit-llvm -o - -std=c++11 |FileCheck %s
3 class x {
4 public: int operator=(int);
5 };
6 void a() {
7 x a;
8 a = 1u;
11 void f(int i, int j) {
12 // CHECK: load i32
13 // CHECK: load i32
14 // CHECK: add nsw i32
15 // CHECK: store i32
16 // CHECK: store i32 17, i32
17 // CHECK: ret
18 (i += j) = 17;
21 // Taken from g++.old-deja/g++.jason/net.C
22 namespace test1 {
23 template <class T> void fn (T t) { }
24 template <class T> struct A {
25 void (*p)(T);
26 A() { p = fn; }
29 A<int> a;
32 // Ensure that we use memcpy when we would have selected a trivial assignment
33 // operator, even for a non-trivially-copyable type.
34 struct A {
35 A &operator=(const A&);
37 struct B {
38 B(const B&);
39 B &operator=(const B&) = default;
40 int n;
42 struct C {
43 A a;
44 B b[16];
46 void b(C &a, C &b) {
47 // CHECK: define {{.*}} @_ZN1CaSERKS_(
48 // CHECK: call {{.*}} @_ZN1AaSERKS_(
49 // CHECK-NOT: call {{.*}} @_ZN1BaSERKS_(
50 // CHECK: call {{.*}} @{{.*}}memcpy
51 // CHECK-NOT: call {{.*}} @_ZN1BaSERKS_(
52 // CHECK: }
53 a = b;