1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-15 04:32:21 +00:00
ton/crypto/func/auto-tests/tests/invalid-pure-1.fc
Aleksandr Kirsanov ef5719d7e6
[FunC] Forbid impure operations inside pure functions
In stdlib, all existing pure functions are asm-implemented.
But since we introduced a `pure` keyword applicable to user-defined functions,
we need to check that they won't have any side effects
(exceptions, globals modification, etc.)
2024-06-14 15:22:58 +03:00

18 lines
205 B
Text

int f_impure();
int f_pure() pure {
return f_impure();
}
int main() {
return f_pure();
}
{-
@compilation_should_fail
@stderr
"""
An impure operation in a pure function
return f_impure();
"""
-}