Workaround for a MSVC required symbol link bug

This commit is contained in:
Denis Blank 2018-12-26 06:19:19 +01:00
parent 7a10363dce
commit a099c504e1
4 changed files with 62 additions and 2 deletions

View File

@ -949,7 +949,7 @@ auto make_cancelling_continuable() {
/// \since 4.0.0
///
template <typename... Args>
auto recover(Args&&... args) {
result<detail::traits::unrefcv_t<Args>...> recover(Args&&... args) {
return make_result(std::forward<Args>(args)...);
}

View File

@ -1,5 +1,6 @@
add_subdirectory(playground)
add_subdirectory(threads)
add_subdirectory(unit-test)
add_subdirectory(mock)
add_subdirectory(simple-benchmark)
add_subdirectory(mock)
add_subdirectory(link)

9
test/link/CMakeLists.txt Normal file
View File

@ -0,0 +1,9 @@
add_executable(test-link
${CMAKE_CURRENT_LIST_DIR}/test-link.cpp)
target_link_libraries(test-link
PRIVATE
continuable)
add_test(NAME continuable-link-tests
COMMAND test-link)

50
test/link/test-link.cpp Normal file
View File

@ -0,0 +1,50 @@
/*
Copyright(c) 2015 - 2018 Denis Blank <denis.blank at outlook dot com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
**/
/// This test is for a MSVC bug where a symbol is accidentaly referenced
/// against cti::recover.
#include <continuable/continuable.hpp>
namespace my {
using cti::cancel;
using cti::continuable;
using cti::make_ready_continuable;
using cti::recover;
using cti::result;
continuable<> testit(int argc) {
return make_ready_continuable(argc).then([](int argc) -> result<> {
if (argc > 0) {
return recover();
} else {
return cancel();
}
});
}
} // namespace my
int main(int argc, char**) {
my::testit(argc);
return 0;
}