http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57699
Bug ID: 57699 Summary: Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C) Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org In cp/parser.c the function cp_parser_parameter_declaration_clause has: else if (token->type == CPP_CLOSE_PAREN) /* There are no parameters. */ { #ifndef NO_IMPLICIT_EXTERN_C if (in_system_header && current_class_type == NULL && current_lang_name == lang_name_c) return NULL_TREE; else #endif return void_list_node; } This means that on "implicit extern C" systems (ones not known to have C++ compatible libc headers) we interpret void(*)() as void(*)(...) This might be necessary to properly handle libc headers on those systems, but should not be enabled for libstdc++ headers (or more generally, any headers actually written in C++) because when we write void(*)() in C++ we damn well mean what we wrote, we shouldn't have to say void(*)(void) This has caused problems more than once in libstdc++, where correct C++ code in an explicit extern "C" block is misinterpreted by the front end, because libstdc++ headers are system headers (due to the #pragma we use) and we sometimes have to declare functions in extern "C" blocks. The problems are not found immediately because they only happen on less-tested targets such as AIX and eCos: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57691 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50982#c40 It would be nice to have some way to mark libstdc++ headers to prevent the code above returning NULL_TREE.