Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/inline-asm2.C

raw
1 // P1668R1: Permit unevaluated inline asm in constexpr functions
2 // PR c++/91346
3 // { dg-do compile { target c++20 } }
4
5 constexpr int
6 foo (bool b)
7 {
8 if (b)
9 return 42;
10 asm (""); // { dg-error "inline assembly is not a constant expression" }
11 // { dg-message "only unevaluated inline assembly" "" { target *-*-* } .-1 }
12 return -1;
13 }
14
15 constexpr int i = foo (true);
16 static_assert(i == 42, "");
17 constexpr int j = foo (false); // { dg-message "in .constexpr. expansion of" }