1 // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s 2 3 int* a = &(int){1}; 4 struct s {int a, b, c;} * b = &(struct s) {1, 2, 3}; 5 // Not working; complex constants are broken 6 // _Complex double * x = &(_Complex double){1.0f}; 7 8 void xxx() { 9 int* a = &(int){1}; 10 struct s {int a, b, c;} * b = &(struct s) {1, 2, 3}; 11 _Complex double * x = &(_Complex double){1.0f}; 12 } 13 14 // CHECK: define void @f() 15 void f() { 16 typedef struct S { int x,y; } S; 17 // CHECK: [[S:%[a-zA-Z0-9.]+]] = alloca [[STRUCT:%[a-zA-Z0-9.]+]], 18 struct S s; 19 // CHECK-NEXT: [[COMPOUNDLIT:%[a-zA-Z0-9.]+]] = alloca [[STRUCT]] 20 // CHECK-NEXT: [[CX:%[a-zA-Z0-9.]+]] = getelementptr inbounds [[STRUCT]]* [[COMPOUNDLIT]], i32 0, i32 0 21 // CHECK-NEXT: [[SY:%[a-zA-Z0-9.]+]] = getelementptr inbounds [[STRUCT]]* [[S]], i32 0, i32 1 22 // CHECK-NEXT: [[TMP:%[a-zA-Z0-9.]+]] = load i32* [[SY]] 23 // CHECK-NEXT: store i32 [[TMP]], i32* [[CX]] 24 // CHECK-NEXT: [[CY:%[a-zA-Z0-9.]+]] = getelementptr inbounds [[STRUCT]]* [[COMPOUNDLIT]], i32 0, i32 1 25 // CHECK-NEXT: [[SX:%[a-zA-Z0-9.]+]] = getelementptr inbounds [[STRUCT]]* [[S]], i32 0, i32 0 26 // CHECK-NEXT: [[TMP:%[a-zA-Z0-9.]+]] = load i32* [[SX]] 27 // CHECK-NEXT: store i32 [[TMP]], i32* [[CY]] 28 // CHECK-NEXT: [[SI8:%[a-zA-Z0-9.]+]] = bitcast [[STRUCT]]* [[S]] to i8* 29 // CHECK-NEXT: [[COMPOUNDLITI8:%[a-zA-Z0-9.]+]] = bitcast [[STRUCT]]* [[COMPOUNDLIT]] to i8* 30 // CHECK-NEXT: call void @llvm.memcpy{{.*}}(i8* [[SI8]], i8* [[COMPOUNDLITI8]] 31 s = (S){s.y,s.x}; 32 // CHECK-NEXT: ret void 33 } 34