ITADN

Infinite recursion in CLI::App::get_option_no_throw

#1315OpenThe0Dev 创建于 2026-03-20
bug
T
The0Devcommented
Hello. I've encountered a fatal bug when using an option group within a subcommand while fallthrough is enabled. Tested on the latest commit. ```C++ #include <filesystem> #include <CLI/CLI.hpp> static std::filesystem::path path; static bool flag = false; int main(int argc, char **argv) { CLI::App app; app.add_flag("--flag,!--no-flag", flag, "Enable a flag")->default_val(false); // Disabling this prevents the issue: app.fallthrough(true); auto *sub = app.add_subcommand("sub", "Execute a subcommand"); auto group = sub->add_option_group("GROUP"); // Fails: group->add_option("-p,--path", path, "An option")->check(CLI::ExistingFile); sub->fallthrough(true); return 0; } ```
2 条评论