Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wunused-result-2.C

raw
1 // PR c++/66177
2
3 struct QSize
4 {
5 QSize(int w, int h) : wd(w), ht(h) {}
6
7 QSize expandedTo() const __attribute__ ((__warn_unused_result__))
8 {
9 return QSize(2, 3);
10 }
11
12 private:
13 int wd;
14 int ht;
15 };
16
17 void foo()
18 {
19 QSize sz(2, 2);
20 sz.expandedTo(); // { dg-warning "warn_unused_result" }
21 }