7da0657fda
This relaxes our rules to allow calls to declared (but not yet defined) functions. With that rule change, we have to specifically detect static recursion and produce an error. Bug: skia:12137 Change-Id: I39cc281fcd73fb30014bc7b43043552623727e03 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431537 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
35 lines
534 B
Plaintext
35 lines
534 B
Plaintext
// Expect 1 errors (with f_one(int), f_two, f_three in cycle)
|
|
|
|
// Complex recursion spanning several functions with overloads, etc.
|
|
|
|
void f_one(bool b);
|
|
void f_one(int n);
|
|
void f_two(int n);
|
|
void f_three(int n);
|
|
void f_four(int n);
|
|
|
|
void f_one(bool b) {
|
|
int n = b ? 1 : 0;
|
|
f_one(n);
|
|
}
|
|
|
|
void f_one(int n) {
|
|
if (n > 0) {
|
|
f_four(n);
|
|
} else {
|
|
f_two(n);
|
|
}
|
|
}
|
|
|
|
void f_two(int n) {
|
|
for (int i = 0; i < 4; ++i) {
|
|
f_three(n);
|
|
}
|
|
}
|
|
|
|
void f_three(int n) {
|
|
f_one(n);
|
|
}
|
|
|
|
void f_four(int n) {}
|