Debian Codegraph @

clang/test/AST/ByteCode/depth-limit2.cpp

raw
1 // RUN: %clang_cc1 -fexperimental-new-constant-interpreter -fconstexpr-depth=2 -verify %s
2 // RUN: %clang_cc1 -fconstexpr-depth=2 -verify=ref %s
3
4
5 constexpr int func() {
6 return 12;
7 }
8
9 constexpr int foo() {
10 return func(); // expected-note {{exceeded maximum depth of 2 calls}} \
11 // ref-note {{exceeded maximum depth of 2 calls}}
12 }
13
14 constexpr int bar() {
15 return foo(); // expected-note {{in call to 'foo()'}} \
16 // ref-note {{in call to 'foo()'}}
17 }
18
19 static_assert(bar() == 12, ""); // expected-error {{not an integral constant expression}} \
20 // expected-note {{in call to 'bar()'}} \
21 // ref-error {{not an integral constant expression}} \
22 // ref-note {{in call to 'bar()'}}
23