https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101052
Bug ID: 101052
Summary: Suggest stdlib.h when exit(1) is called
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jg at jguk dot org
Target Milestone: ---
>From godbolt GCC trunk 13 June 2021
Could #include <stdlib.h> be suggested please.
-Wall -O2
123
<Compilation failed>
# For more information see the output window
x86-64 gcc (trunk) - 322ms
#1 with x86-64 gcc (trunk)
<source>: In function 'void f(int*)':
<source>:8:9: error: 'exit' was not declared in this scope
8 | exit(1);
| ^~~~
Compiler returned: 1
//#include <stdlib.h>
#include <cstddef>
void f(int * g)
{
if(NULL == g)
{
exit(1);
}
}