Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (15 sloc) 312 Bytes
int a = 1;
constexpr int b = 100;
constexpr int foo(int n)
[[ expects: a <= n ]] // error: `a` is not constexpr
[[ expects: n < b ]] // OK
{
[[ assert: n > 2*a ]]; // error: `a` is not constexpr
[[ assert: n < 2*b ]]; // OK
return 2*n;
}
int main()
{
foo(50);
return 0;
}
You can’t perform that action at this time.