24 lines · cpp
1// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -fconstexpr-depth=2 -verify %s2// RUN: %clang_cc1 -fconstexpr-depth=2 -verify=ref %s3 4 5constexpr int func() {6 return 12;7}8 9constexpr int foo() {10 return func(); // expected-note {{exceeded maximum depth of 2 calls}} \11 // ref-note {{exceeded maximum depth of 2 calls}}12}13 14constexpr int bar() {15 return foo(); // expected-note {{in call to 'foo()'}} \16 // ref-note {{in call to 'foo()'}}17}18 19static_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 24