...
However, many compilers fail to integrate language linkage into the function's type, despite the normative requirement to do so in the C++ Standard. For instance, GCC 6.1.0, Clang 3.9, and Microsoft Visual Studio 2015 all consider the following code snippet to be ill-formed due to a redefinition of f()
rather than a well-formed overload of f()
.
Code Block |
---|
typedef void (*cpp_func)(void); extern "C" typedef void (*c_func)(void); void f(cpp_func fp) {} void f(c_func fp) {} |
...