diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index ff2a4bc6b..642308932 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -205,6 +205,8 @@ KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_MEMBER_TEMPLATES "Checking for member template support" DIRECT) KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_FULL_SPECIALIZATION "Checking for standard template specialization syntax" DIRECT) +KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP + "Checking whether argument dependent lookup is supported" DIRECT) IF(UNIX) KWSYS_PLATFORM_CXX_TEST(KWSYS_STAT_HAS_ST_MTIM diff --git a/Source/kwsys/Configure.hxx.in b/Source/kwsys/Configure.hxx.in index 1ea8b3711..3cddb3470 100644 --- a/Source/kwsys/Configure.hxx.in +++ b/Source/kwsys/Configure.hxx.in @@ -76,6 +76,9 @@ /* Whether the compiler supports member templates. */ #define @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES @KWSYS_CXX_HAS_MEMBER_TEMPLATES@ +/* Whether the compiler supports argument dependent lookup. */ +#define @KWSYS_NAMESPACE@_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP @KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP@ + /* Whether the compiler supports standard full specialization syntax. */ #define @KWSYS_NAMESPACE@_CXX_HAS_FULL_SPECIALIZATION @KWSYS_CXX_HAS_FULL_SPECIALIZATION@ @@ -128,6 +131,7 @@ # define KWSYS_CXX_DECL_TYPENAME @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME # define KWSYS_STL_HAS_ALLOCATOR_REBIND @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND # define KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT +# define KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP @KWSYS_NAMESPACE@_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP #endif #endif diff --git a/Source/kwsys/hashtable.hxx.in b/Source/kwsys/hashtable.hxx.in index 80f633c72..cb2f19f16 100644 --- a/Source/kwsys/hashtable.hxx.in +++ b/Source/kwsys/hashtable.hxx.in @@ -1087,6 +1087,14 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> } // namespace @KWSYS_NAMESPACE@ +// Normally the comparison operators should be found in the @KWSYS_NAMESPACE@ +// namespace by argument dependent lookup. For compilers that do not +// support it we must bring them into the global namespace now. +#if !@KWSYS_NAMESPACE@_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP +using @KWSYS_NAMESPACE@::operator==; +using @KWSYS_NAMESPACE@::operator!=; +#endif + #if defined(_MSC_VER) # pragma warning (pop) #endif diff --git a/Source/kwsys/kwsysPlatformCxxTests.cxx b/Source/kwsys/kwsysPlatformCxxTests.cxx index 74e83bd41..9edbfc0ab 100644 --- a/Source/kwsys/kwsysPlatformCxxTests.cxx +++ b/Source/kwsys/kwsysPlatformCxxTests.cxx @@ -108,6 +108,20 @@ template <> struct A int main() { return A::f(); } #endif +#ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP +namespace N +{ + class A {}; + int f(A*) { return 0; } +} +void f(void*); +int main() +{ + N::A* a = 0; + return f(a); +} +#endif + #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND #include template diff --git a/bootstrap b/bootstrap index 50819282d..15a46ce53 100755 --- a/bootstrap +++ b/bootstrap @@ -208,6 +208,7 @@ cmake_kwsys_config_replace_string () s/@KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@/${KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS}/g; s/@KWSYS_CXX_HAS_MEMBER_TEMPLATES@/${KWSYS_CXX_HAS_MEMBER_TEMPLATES}/g; s/@KWSYS_CXX_HAS_FULL_SPECIALIZATION@/${KWSYS_CXX_HAS_FULL_SPECIALIZATION}/g; + s/@KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP@/${KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP}/g; s/@KWSYS_STAT_HAS_ST_MTIM@/${KWSYS_STAT_HAS_ST_MTIM}/g;}" >> "${OUTFILE}.tmp" if [ -f "${OUTFILE}.tmp" ]; then if diff "${OUTFILE}" "${OUTFILE}.tmp" > /dev/null 2> /dev/null ; then @@ -721,6 +722,7 @@ KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=0 KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=0 KWSYS_CXX_HAS_MEMBER_TEMPLATES=0 KWSYS_CXX_HAS_FULL_SPECIALIZATION=0 +KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=0 # Hardcode these kwsys features. They work on all known UNIX compilers anyway. KWSYS_STL_STRING_HAVE_ISTREAM=1 @@ -838,6 +840,15 @@ else echo "${cmake_cxx_compiler} does not have standard template specialization syntax" fi +if cmake_try_run "${cmake_cxx_compiler}" \ + "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP" \ + "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then + KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=1 + echo "${cmake_cxx_compiler} has argument dependent lookup" +else + echo "${cmake_cxx_compiler} does not have argument dependent lookup" +fi + if cmake_try_run "${cmake_cxx_compiler}" \ "${cmake_cxx_flags} -DTEST_KWSYS_STAT_HAS_ST_MTIM" \ "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then