Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/nodiscard8.C

raw
1 // PR c++/100666
2 // { dg-do compile { target c++11 } }
3
4 [[nodiscard]] decltype(nullptr) bar ();
5 extern void foo (...);
6 template <typename T> void qux (T);
7
8 void
9 baz ()
10 {
11 foo (bar ()); // { dg-bogus "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
12 bar (); // { dg-warning "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
13 auto x = bar (); // { dg-bogus "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
14 qux (bar ()); // { dg-bogus "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
15 }