diff --git a/include/CLI/impl/App_inl.hpp b/include/CLI/impl/App_inl.hpp index 614805dd..2a0192c8 100644 --- a/include/CLI/impl/App_inl.hpp +++ b/include/CLI/impl/App_inl.hpp @@ -582,6 +582,7 @@ CLI11_INLINE void App::clear() { missing_.clear(); parsed_subcommands_.clear(); + parse_order_.clear(); for(const Option_p &opt : options_) { opt->clear(); } diff --git a/tests/AppTest.cpp b/tests/AppTest.cpp index 63f97e08..b75bf9c5 100644 --- a/tests/AppTest.cpp +++ b/tests/AppTest.cpp @@ -2016,6 +2016,8 @@ TEST_CASE_METHOD(TApp, "OriginalOrder", "[app]") { CHECK(std::vector({2}) == st2); CHECK(std::vector({op1, op2, op1, op1}) == app.parse_order()); + app.clear(); + CHECK(app.parse_order().empty()); } TEST_CASE_METHOD(TApp, "NeedsFlags", "[app]") {