File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
clang/test/BoundsSafety/Sema Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -39,3 +39,29 @@ class FAM_ARROW {
39
39
T *tp;
40
40
int fam[__counted_by(tp->count)]; // expected-error{{arrow notation not allowed for struct member in count parameter}}
41
41
};
42
+
43
+ class FAM_THIS_ARROW_ARROW {
44
+ T *tp;
45
+ int fam[__counted_by(this ->tp->count)]; // expected-error{{arrow notation not allowed for struct member in count parameter}}
46
+ };
47
+
48
+ class FAM_THIS_ARROW_DOT {
49
+ T t;
50
+ int fam[__counted_by(this ->t.count)]; // dot-expressions in counted-by is ok for FAMs
51
+ };
52
+
53
+ class FAM_ARITHMETIC {
54
+ int count;
55
+ int offset;
56
+ int fam[__counted_by(count - offset)]; // ok
57
+ };
58
+
59
+ class FAM_THIS_PTR_ARITHMETIC {
60
+ int count;
61
+ int fam[__counted_by((this + 1 )->count)]; // expected-error{{arrow notation not allowed for struct member in count parameter}}
62
+ };
63
+
64
+ class FAM_THIS_PTR_DEREFERENCE {
65
+ int count;
66
+ int fam[__counted_by((*this ).count)]; // expected-error{{invalid argument expression to bounds attribute}}
67
+ };
You can’t perform that action at this time.
0 commit comments