aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/nodiscard-constructor2.C
blob: 3abb11847d1097943928cbedfd6d4d3bbf075ce3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// PR c++/99362
// { dg-do compile { target c++20 } }

struct S {
  [[nodiscard]] S() {}
  S(int) {}
};

int main()
{
  S s;
  S();		// { dg-warning "ignoring return value" }
  (void)(S());
  S t = 1;
  S(1);
  (void)(S(1));
}