mirror of
https://github.com/boostorg/core.git
synced 2026-05-03 19:31:00 +02:00
Move functor to its own namespace to block bringing boost::core to ADL.
This commit is contained in:
@@ -195,6 +195,9 @@ compile-fail fclose_deleter_compile_fail_adl.cpp
|
||||
: <target-os>windows:<define>_CRT_SECURE_NO_WARNINGS <target-os>windows:<define>_CRT_SECURE_NO_DEPRECATE $(warnings-as-errors-off) ;
|
||||
|
||||
run functor_test.cpp ;
|
||||
compile-fail functor_compile_fail_adl.cpp
|
||||
: $(warnings-as-errors-off) ;
|
||||
|
||||
|
||||
run pointer_traits_pointer_test.cpp ;
|
||||
run pointer_traits_element_type_test.cpp ;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2024.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
/*!
|
||||
* \file functor_compile_fail_adl.cpp
|
||||
* \author Andrey Semashev
|
||||
* \date 02.02.2024
|
||||
*
|
||||
* This file tests that \c boost::core::functor doesn't bring namespace
|
||||
* boost::core into ADL.
|
||||
*/
|
||||
|
||||
#include <boost/core/functor.hpp>
|
||||
|
||||
void func() {}
|
||||
|
||||
namespace boost::core {
|
||||
|
||||
void check_adl(functor< ::func > const&)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace boost::core
|
||||
|
||||
int main()
|
||||
{
|
||||
// Must not find boost::check_adl
|
||||
check_adl(boost::core::functor< ::func >());
|
||||
}
|
||||
Reference in New Issue
Block a user