comparison gcc/testsuite/g++.dg/cpp2a/inline-asm2.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 // P1668R1: Permit unevaluated inline asm in constexpr functions
2 // PR c++/91346
3 // { dg-do compile { target c++2a } }
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" }