diff --git a/src/cc65/main.c b/src/cc65/main.c index bef646cdd..7dc5417f6 100644 --- a/src/cc65/main.c +++ b/src/cc65/main.c @@ -1089,7 +1089,7 @@ int main (int argc, char* argv[]) Compile (InputFile); /* Create the output file if we didn't had any errors */ - if (PreprocessOnly == 0 && (ErrorCount == 0 || Debug)) { + if (PreprocessOnly == 0 && (GetTotalErrors () == 0 || Debug)) { /* Emit literals, do cleanup and optimizations */ FinishCompile (); @@ -1115,5 +1115,5 @@ int main (int argc, char* argv[]) DoneSegAddrSizes (); /* Return an apropriate exit code */ - return (ErrorCount > 0)? EXIT_FAILURE : EXIT_SUCCESS; + return (GetTotalErrors () > 0)? EXIT_FAILURE : EXIT_SUCCESS; } diff --git a/test/err/bug2312-pperror-only.c b/test/err/bug2312-pperror-only.c new file mode 100644 index 000000000..bdec33956 --- /dev/null +++ b/test/err/bug2312-pperror-only.c @@ -0,0 +1,8 @@ +/* Bug #2312 */ + +#error "Compiler should exit with failure" + +int main(void) +{ + return 0; +}