From bd5bbdebf116bb03da335d0e18a55a5597b55548 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 29 Jul 2025 06:04:29 +0900 Subject: feat: function main() now returns zero if no return value are explicitly provided --- tests/064.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/064.sh (limited to 'tests') diff --git a/tests/064.sh b/tests/064.sh new file mode 100644 index 0000000..80fba4f --- /dev/null +++ b/tests/064.sh @@ -0,0 +1,22 @@ +set -e + +# C99: 5.1.2.2.3 +bash ../../test_exit_code.sh 0 <<'EOF' +int main() { +} +EOF + +bash ../../test_exit_code.sh 0 <<'EOF' +int main() { + 1 + 2 + 3; +} +EOF + +bash ../../test_exit_code.sh 0 <<'EOF' +int main() { + if (1) { + } else { + return 1; + } +} +EOF -- cgit v1.2.3-70-g09d2