comparison gcc/testsuite/g++.dg/ext/constexpr-attr-cleanup1.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 // { dg-do compile { target c++2a } }
2
3 constexpr void
4 cleanup (int *x)
5 {
6 if (x)
7 asm (""); // { dg-error "inline assembly is not a constant expression" }
8 } // { dg-message "only unevaluated inline assembly is allowed in a 'constexpr' function" "" { target *-*-* } .-1 }
9
10 constexpr void
11 cleanup2 (int *x)
12 {
13 }
14
15 constexpr bool
16 foo ()
17 {
18 int a __attribute__((cleanup (cleanup))) = 1; // { dg-message "in 'constexpr' expansion of" }
19 return true;
20 }
21
22 constexpr bool
23 bar ()
24 {
25 int a __attribute__((cleanup (cleanup2))) = 1;
26 return true;
27 }
28
29 constexpr auto x = foo (); // { dg-message "in 'constexpr' expansion of" }
30 constexpr auto y = bar ();