You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clang/test/Sema/attr-malloc_span.c
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -29,3 +29,10 @@ typedef struct {
29
29
size_tn2;
30
30
} invalid_span2;
31
31
invalid_span2returns_non_std_span2 (void) __attribute((malloc_span)); // expected-warning {{attribute only applies to functions that return span-like structures}}
32
+
33
+
// Function pointers are not allowed.
34
+
typedefstruct {
35
+
int (*func_ptr)(void);
36
+
size_tn;
37
+
} func_span;
38
+
func_spanreturns_func_span (void) __attribute((malloc_span)); // expected-warning {{attribute only applies to functions that return span-like structures}}
// Returning pointers to data members is not allowed.
9
+
structDataMemberSpan {
10
+
int SomeClass::* member_ptr;
11
+
int n;
12
+
};
13
+
14
+
DataMemberSpan returns_data_member_span(void) __attribute((malloc_span)) { // expected-warning {{attribute only applies to functions that return span-like structures}}
15
+
return DataMemberSpan{};
16
+
}
17
+
18
+
// Returning pointers to member functions is not allowed.
19
+
structMemberFuncSpan {
20
+
void (SomeClass::*member_func_ptr)();
21
+
int n;
22
+
};
23
+
24
+
MemberFuncSpan returns_member_func_span(void) __attribute((malloc_span)) { // expected-warning {{attribute only applies to functions that return span-like structures}}
0 commit comments