42 lines · cpp
1// RUN: %clang_cc1 -O2 -triple=x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s2struct agg 3{4int a ;5int b ;6} t;7struct agg a;8int vt=10;9_Complex float cf;10int volatile vol =10;11void f0() {12 const_cast<volatile _Complex float &>(cf) = const_cast<volatile _Complex float&>(cf) + 1;13// CHECK: [[Re1:%.*]] = load volatile float, ptr @cf14// CHECK: [[Im1:%.*]] = load volatile float, ptr getelementptr15// CHECK: [[Add1:%.*]] = fadd float [[Re1]], 1.000000e+0016// CHECK: store volatile float [[Add1]], ptr @cf17// CHECK: store volatile float [[Im1]], ptr getelementptr18 static_cast<volatile _Complex float &>(cf) = static_cast<volatile _Complex float&>(cf) + 1;19// CHECK: [[Re2:%.*]] = load volatile float, ptr @cf20// CHECK: [[Im2:%.*]] = load volatile float, ptr getelementptr21// CHECK: [[Add2:%.*]] = fadd float [[Re2]], 1.000000e+0022// CHECK: store volatile float [[Add2]], ptr @cf23// CHECK: store volatile float [[Im2]], ptr getelementptr24 const_cast<volatile int &>(a.a) = const_cast<volatile int &>(t.a) ;25// CHECK: [[I1:%.*]] = load volatile i32, ptr @t26// CHECK: store volatile i32 [[I1]], ptr @a27 static_cast<volatile int &>(a.b) = static_cast<volatile int &>(t.a) ;28// CHECK: [[I2:%.*]] = load volatile i32, ptr @t29// CHECK: store volatile i32 [[I2]], ptr getelementptr30 const_cast<volatile int&>(vt) = const_cast<volatile int&>(vt) + 1;31// CHECK: [[I3:%.*]] = load volatile i32, ptr @vt32// CHECK: [[Add3:%.*]] = add nsw i32 [[I3]], 133// CHECK: store volatile i32 [[Add3]], ptr @vt34 static_cast<volatile int&>(vt) = static_cast<volatile int&>(vt) + 1;35// CHECK: [[I4:%.*]] = load volatile i32, ptr @vt36// CHECK: [[Add4:%.*]] = add nsw i32 [[I4]], 137// CHECK: store volatile i32 [[Add4]], ptr @vt38 vt = const_cast<int&>(vol);39// [[I5:%.*]] = load i32, ptr @vol40// store i32 [[I5]], ptr @vt41}42