Skip to content

Commit e3b105b

Browse files
committed
update tests
1 parent 65e0a71 commit e3b105b

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

clang/test/Analysis/div-zero-cxx20.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ struct E {
2525
E(int a) : d(a) {}
2626
};
2727

28+
struct Storage {
29+
int x;
30+
};
31+
2832
int t1() {
2933
A a{42};
3034
return 1 / (a.x - 42); // expected-warning {{Division by zero}}
@@ -49,4 +53,9 @@ int t5() {
4953
E e{32};
5054
return 1 / (e.d.x - 32); // expected-warning {{Division by zero}}
5155
}
56+
57+
int t6() {
58+
Storage w(32);
59+
return 1 / (w.x - 32); // expected-warning {{Division by zero}}
60+
}
5261
} // namespace GH148875

clang/test/Analysis/div-zero.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int fooPR10616 (int qX ) {
1313
}
1414

1515
namespace GH148875 {
16-
struct A {
16+
struct A {
1717
int x;
1818
A(int v) : x(v) {}
1919
};
@@ -37,6 +37,10 @@ struct E {
3737
E(int a) : d{a} {}
3838
};
3939

40+
struct Storage {
41+
int x;
42+
};
43+
4044
int t1() {
4145
A a{42};
4246
return 1 / (a.x - 42); // expected-warning {{Division by zero}}
@@ -61,4 +65,9 @@ int t5() {
6165
E e{32};
6266
return 1 / (e.d.x - 32); // expected-warning {{Division by zero}}
6367
}
68+
69+
int t6() {
70+
Storage w{32};
71+
return 1 / (w.x - 32); // expected-warning {{Division by zero}}
72+
}
6473
}

0 commit comments

Comments
 (0)