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