comparison gcc/testsuite/g++.dg/cpp2a/nodiscard-constructor.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* nodiscard attribute tests */
2 /* { dg-do compile { target c++2a } } */
3 /* { dg-options "-O -ftrack-macro-expansion=0" } */
4
5 struct A { [[nodiscard("bad constructor")]] A() {} };
6 struct B { [[nodiscard]] B() {} };
7
8 void
9 test (void)
10 {
11 A{}; /* { dg-warning "(?n)nodiscard.*bad constructor" } */
12 B{}; /* { dg-warning "(?n)nodiscard" } */
13 }