diff options
author | Bruno Haible <bruno@clisp.org> | 2010-03-11 12:39:15 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2010-03-11 12:39:15 +0100 |
commit | 3c6b938cb0b5c4155b0254ae0406a6789c1efbcf (patch) | |
tree | 01c930ce0a23d7523234729762393fe3990cd275 /build-aux | |
parent | e961f4c04b6bbd1bf6f98c91fa0e6ae1d7a8eea9 (diff) | |
download | gnulib-3c6b938cb0b5c4155b0254ae0406a6789c1efbcf.tar.gz |
Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Diffstat (limited to 'build-aux')
-rw-r--r-- | build-aux/c++defs.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/build-aux/c++defs.h b/build-aux/c++defs.h index 80ce7ace5e..138daf2f44 100644 --- a/build-aux/c++defs.h +++ b/build-aux/c++defs.h @@ -176,16 +176,21 @@ are used to silence the "cannot find a match" and "invalid conversion" errors that would otherwise occur. */ #if defined __cplusplus && defined GNULIB_NAMESPACE + /* The outer cast must be a reinterpret_cast. + The inner cast: When the function is defined as a set of overloaded + functions, it works as a static_cast<>, choosing the designated variant. + When the function is defined as a single variant, it works as a + reinterpret_cast<>. The parenthesized cast syntax works both ways. */ # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ namespace GNULIB_NAMESPACE \ { \ static rettype (*func) parameters = \ reinterpret_cast<rettype(*)parameters>( \ - reinterpret_cast<rettype2(*)parameters2>(::func)); \ + (rettype2(*)parameters2)(::func)); \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else -# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ +# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif |