1 // RUN: %clang_cc1 -std=c++1y -fsyntax-only -verify %s -DMAX=1234 -fconstexpr-steps 1234
2 // RUN: %clang_cc1 -std=c++1y -fsyntax-only -verify %s -DMAX=10 -fconstexpr-steps 10
3 // RUN: %clang -std=c++1y -fsyntax-only -Xclang -verify %s -DMAX=12345 -fconstexpr-steps=12345
4 
5 // This takes a total of n + 4 steps according to our current rules:
6 //  - One for the compound-statement that is the function body
7 //  - One for the 'for' statement
8 //  - One for the 'int k = 0;' statement
9 //  - One for each of the n evaluations of the compound-statement in the 'for' body
10 //  - One for the 'return' statemnet
steps(int n)11 constexpr bool steps(int n) {
12   for (int k = 0; k != n; ++k) {}
13   return true; // expected-note {{step limit}}
14 }
15 
16 static_assert(steps((MAX - 4)), ""); // ok
17 static_assert(steps((MAX - 3)), ""); // expected-error {{constant}} expected-note{{call}}
18