aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/nodiscard8.C
blob: b5096acbea1072760c13c89be4f972de4eaf386e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// PR c++/100666
// { dg-do compile { target c++11 } }

[[nodiscard]] decltype(nullptr) bar ();
extern void foo (...);
template <typename T> void qux (T);

void
baz ()
{
  foo (bar ());		// { dg-bogus "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
  bar ();		// { dg-warning "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
  auto x = bar ();	// { dg-bogus "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
  qux (bar ());		// { dg-bogus "ignoring return value of '\[^\n\r]*', declared with attribute 'nodiscard'" }
}