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/c2x-nodiscard.c
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ struct [[nodiscard]] S1 { // ok
9
9
struct [[nodiscard, nodiscard]] S2 { // ok
10
10
inti;
11
11
};
12
-
struct [[nodiscard("Wrong")]] S3 {
12
+
struct [[nodiscard("Wrong")]] S3 {// expected-note {{'S3' has been explicitly marked nodiscard here}}
13
13
inti;
14
14
};
15
15
@@ -20,15 +20,15 @@ enum [[nodiscard]] E1 { One };
20
20
21
21
[[nodiscard]] inti; // expected-warning {{'nodiscard' attribute only applies to Objective-C methods, enums, structs, unions, classes, functions, function pointers, and typedefs}}
22
22
23
-
struct [[nodiscard]] S4 {
23
+
struct [[nodiscard]] S4 {// expected-note {{'S4' has been explicitly marked nodiscard here}}
24
24
inti;
25
25
};
26
26
structS4get_s(void);
27
27
28
-
enum [[nodiscard]] E2 { Two };
28
+
enum [[nodiscard]] E2 { Two };// expected-note {{'E2' has been explicitly marked nodiscard here}}
29
29
enumE2get_e(void);
30
30
31
-
[[nodiscard]] intget_i(void);
31
+
[[nodiscard]] intget_i(void);// expected-note {{'get_i' has been explicitly marked nodiscard here}}
32
32
33
33
voidf2(void) {
34
34
get_s(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
@@ -43,7 +43,7 @@ void f2(void) {
43
43
(void)get_e();
44
44
}
45
45
46
-
struct [[nodiscard]] error_info{
46
+
struct [[nodiscard]] error_info{// expected-note {{'error_info' has been explicitly marked nodiscard here}}
47
47
inti;
48
48
};
49
49
@@ -54,7 +54,7 @@ void test_missiles(void) {
54
54
launch_missiles();
55
55
}
56
56
57
-
[[nodiscard]] intf3();
57
+
[[nodiscard]] intf3();// expected-note {{'f3' has been explicitly marked nodiscard here}}
0 commit comments