llvm-project/clang/test/AST/ByteCode/depth-limit2.cpp
Timm Baeder a07aba5d44
[clang] Rename all AST/Interp stuff to AST/ByteCode (#104552)
"Interp" clashes with the clang interpreter and people often confuse
this.
2024-08-16 17:13:12 +02:00

24 lines
806 B
C++

// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -fconstexpr-depth=2 -verify %s
// RUN: %clang_cc1 -fconstexpr-depth=2 -verify=ref %s
constexpr int func() {
return 12;
}
constexpr int foo() {
return func(); // expected-note {{exceeded maximum depth of 2 calls}} \
// ref-note {{exceeded maximum depth of 2 calls}}
}
constexpr int bar() {
return foo(); // expected-note {{in call to 'foo()'}} \
// ref-note {{in call to 'foo()'}}
}
static_assert(bar() == 12, ""); // expected-error {{not an integral constant expression}} \
// expected-note {{in call to 'bar()'}} \
// ref-error {{not an integral constant expression}} \
// ref-note {{in call to 'bar()'}}