diff --git a/include/continuable/continuable-base.hpp b/include/continuable/continuable-base.hpp index 2feaea1..222ab39 100644 --- a/include/continuable/continuable-base.hpp +++ b/include/continuable/continuable-base.hpp @@ -949,7 +949,7 @@ auto make_cancelling_continuable() { /// \since 4.0.0 /// template -auto recover(Args&&... args) { +result...> recover(Args&&... args) { return make_result(std::forward(args)...); } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 069d43b..4f6ba3a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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) diff --git a/test/link/CMakeLists.txt b/test/link/CMakeLists.txt new file mode 100644 index 0000000..a49aa73 --- /dev/null +++ b/test/link/CMakeLists.txt @@ -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) diff --git a/test/link/test-link.cpp b/test/link/test-link.cpp new file mode 100644 index 0000000..9ff168d --- /dev/null +++ b/test/link/test-link.cpp @@ -0,0 +1,50 @@ + +/* + Copyright(c) 2015 - 2018 Denis Blank + + 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 + +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; +}