1 // RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux -emit-llvm -o - | FileCheck %s
4 // Check that we don't attempt to compare the unnamed bitfields
9 friend bool operator==(A
, A
);
17 friend bool operator==(B
, B
);
20 bool operator==(A
, A
) = default;
21 // CHECK: define{{.*}} @_Zeq1AS_
22 // CHECK: %[[LHS:.+]] = alloca %struct.A, align 4
23 // CHECK: %[[RHS:.+]] = alloca %struct.A, align 4
24 // CHECK: %[[LHS_LOAD:.+]] = load i8, ptr %[[LHS]], align 4
25 // CHECK: %[[LHS_CLEAR:.+]] = and i8 %[[LHS_LOAD]], 1
26 // CHECK: %[[LHS_CAST:.+]] = zext i8 %[[LHS_CLEAR]] to i32
28 // CHECK: %[[RHS_LOAD:.+]] = load i8, ptr %[[RHS]]
29 // CHECK: %[[RHS_CLEAR:.+]] = and i8 %[[RHS_LOAD]], 1
30 // CHECK: %[[RHS_CAST:.+]] = zext i8 %[[RHS_CLEAR]] to i32
31 // CHECK: %[[CMP:.*]] = icmp eq i32 %[[LHS_CAST]], %[[RHS_CAST]]
32 // CHECK: ret i1 %[[CMP]]
34 bool operator==(B
, B
) = default;
35 // CHECK: define{{.*}} @_Zeq1BS_
36 // CHECK: %[[LHS_B:.+]] = alloca %struct.B, align 4
37 // CHECK: %[[RHS_B:.+]] = alloca %struct.B, align 4
38 // CHECK: %[[LHS_LOAD_B:.+]] = load i32, ptr %[[LHS_B]], align 4
39 // CHECK: %[[LHS_CLEAR_B:.+]] = and i32 %[[LHS_LOAD_B]], 1
41 // CHECK: %[[RHS_LOAD_B:.+]] = load i32, ptr %[[RHS_B]]
42 // CHECK: %[[RHS_CLEAR_B:.+]] = and i32 %[[RHS_LOAD_B]], 1
43 // CHECK: %[[CMP_B:.*]] = icmp eq i32 %[[LHS_CLEAR_B]], %[[RHS_CLEAR_B]]
44 // CHECK: ret i1 %[[CMP_B]]