-
Couldn't load subscription status.
- Fork 397
Closed
Description
In #325 (commit f9baaea from your fork) you've fixed #330.
Unfortunately, in commit 399e040 of the same PR a use case below started to SIGSEGV:
TEST_F(TApp, EnumCheckedDefaultTransformCallback) {
enum class existing : int16_t { abort, overwrite, remove };
auto cmd = std::make_shared<CLI::App>("deploys the repository somewhere", "deploy");
cmd->add_option("--existing", "What to do if file already exists in the destination")
->transform(
CLI::CheckedTransformer(std::unordered_map<std::string, existing>{{"abort", existing::abort},
{"overwrite", existing ::overwrite},
{"delete", existing::remove},
{"remove", existing::remove}}))
->default_val("abort");
cmd->callback([cmd]() {
EXPECT_EQ(cmd->get_option("--existing")->as<existing>(), existing::abort);
});
app.add_subcommand( cmd );
args = {"deploy"};
run();
}stack trace:
$ gdb ./tests/TransformTest
GNU gdb (Ubuntu 8.2-0ubuntu1~16.04.1) 8.2
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Function(s) boost::.* will be skipped when stepping.
File(s) include/bits/*.h will be skipped when stepping.
Function(s) std::.* will be skipped when stepping.
Reading symbols from ./tests/TransformTest...(no debugging symbols found)...done.
(gdb) r
Starting program: /tmp/cli11/build/tests/TransformTest
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Running main() from /tmp/cli11/CLI11/extern/googletest/googletest/src/gtest_main.cc
[==========] Running 34 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 34 tests from TApp
[ RUN ] TApp.SimpleTransform
[ OK ] TApp.SimpleTransform (0 ms)
[ RUN ] TApp.SimpleTransformInitList
[ OK ] TApp.SimpleTransformInitList (0 ms)
[ RUN ] TApp.SimpleNumericalTransform
[ OK ] TApp.SimpleNumericalTransform (0 ms)
[ RUN ] TApp.EnumTransform
[ OK ] TApp.EnumTransform (0 ms)
[ RUN ] TApp.EnumCheckedTransform
[ OK ] TApp.EnumCheckedTransform (1 ms)
[ RUN ] TApp.EnumCheckedDefaultTransformCallback
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b32ec0 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::empty() const () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) bt
#0 0x00007ffff7b32ec0 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::empty() const () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1 0x0000000000441223 in bool CLI::detail::lexical_assign<TApp_EnumCheckedDefaultTransformCallback_Test::TestBody()::existing, TApp_EnumCheckedDefaultTransformCallback_Test::TestBody()::existing, (CLI::detail::enabler)0>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, TApp_EnumCheckedDefaultTransformCallback_Test::TestBody()::existing&) ()
#2 0x0000000000439afa in bool CLI::detail::lexical_conversion<TApp_EnumCheckedDefaultTransformCallback_Test::TestBody()::existing, TApp_EnumCheckedDefaultTransformCallback_Test::TestBody()::existing, (CLI::detail::enabler)0>(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, TApp_EnumCheckedDefaultTransformCallback_Test::TestBody()::existing&) ()
#3 0x00000000004334dc in void CLI::Option::results<TApp_EnumCheckedDefaultTransformCallback_Test::TestBody()::existing, (CLI::detail::enabler)0>(TApp_EnumCheckedDefaultTransformCallback_Test::TestBody()::existing&) const ()
#4 0x000000000042ea22 in TApp_EnumCheckedDefaultTransformCallback_Test::TestBody()::existing CLI::Option::as<TApp_EnumCheckedDefaultTransformCallback_Test::TestBody()::existing>() const ()
#5 0x000000000040bf8e in TApp_EnumCheckedDefaultTransformCallback_Test::TestBody()::{lambda()#1}::operator()() const ()
#6 0x000000000043389a in std::_Function_handler<void (), TApp_EnumCheckedDefaultTransformCallback_Test::TestBody()::{lambda()#1}>::_M_invoke(std::_Any_data const&) ()
#7 0x000000000047c166 in std::function<void ()>::operator()() const ()
#8 0x0000000000469173 in CLI::App::run_callback(bool) ()
#9 0x0000000000469015 in CLI::App::run_callback(bool) ()
#10 0x0000000000466a61 in CLI::App::parse(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) ()
#11 0x00000000004740f1 in TApp::run() ()
#12 0x000000000040caaa in TApp_EnumCheckedDefaultTransformCallback_Test::TestBody() ()
#13 0x00000000004f8435 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ()
#14 0x00000000004f2fe5 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ()
#15 0x00000000004d2ae8 in testing::Test::Run() ()
#16 0x00000000004d3429 in testing::TestInfo::Run() ()
#17 0x00000000004d3a93 in testing::TestCase::Run() ()
#18 0x00000000004dea92 in testing::internal::UnitTestImpl::RunAllTests() ()
#19 0x00000000004f936b in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ()
#20 0x00000000004f3de1 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ()
#21 0x00000000004dd51a in testing::UnitTest::Run() ()
#22 0x000000000050569b in RUN_ALL_TESTS() ()
#23 0x0000000000505635 in main ()
Metadata
Metadata
Assignees
Labels
No labels