This only calls `noteStep()` on jump opcodes, so this works for loops. It does not prevent "hangs" when a function is just _very_ long (could be interesting how this interfaces with expand statements?). Fixes https://github.com/llvm/llvm-project/issues/165951
11 lines
427 B
C++
11 lines
427 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}}
|
|
|