https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71973
Bug ID: 71973 Summary: c++ handles built-in functions inconsistently Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bernd.edlinger at hotmail dot de Target Milestone: --- I noticed that C++ does not emit a warning when the header defines a built-in function with a different/wrong signature. For instance int fork(void) is a built-in EXT-LIB function: but I define it differently: cat test.c void fork(); gcc -Wall -S test.c test3.c:1:6: warning: conflicting types for built-in function 'fork' void fork(); ^~~~ however with C++ the warning does not fire: cat test.cc extern "C" void fork(); g++ -O3 -Wall -S test.cc zero warnings. However the fact that there is a builtin has an effect: cat test.cc extern "C" void fork() __attribute__((nothrow)) void bar() throw() { fork(); } g++ -O3 -Wall -S test.cc emits eh code in bar which does not happen when the builtin fork is not defined, either by g++ -O3 -Wall -ansi -S test.cc no eh code. ... or changing the name of fork to zork for instance. results also in no eh code. It works of fork is declared as extern "C" void fork() throw(); or if bar is declared as __attribute__((nothrow)) void bar () { fork(); }