llvm-project/clang/test/AST/ByteCode/constexpr-steps.cpp
Timm Baeder dcaab6dd99
[clang][bytecode] Add source info to jump ops (#188003)
The attached test case otherwise results in a function with one jump op
but no source info at all.
2026-03-23 11:45:34 +01:00

18 lines
754 B
C++

// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify %s -fconstexpr-steps=100
constexpr int foo() { // expected-error {{never produces a constant expression}}
while (1) {} // expected-note 2{{constexpr evaluation hit maximum step limit}}
return 0;
}
static_assert (foo() == 0, ""); // expected-error {{not an integral constant expression}} \
// expected-note {{in call to}}
constexpr void addr() { // expected-error {{never produces a constant expression}}
for (;;) // expected-note 2{{constexpr evaluation hit maximum step limit}}
;
}
static_assert((addr(), 1) == 1); // expected-error {{not an integral constant expression}} \
// expected-note {{in call to}}