Skip to content

Commit 288818f

Browse files
committed
Fix shadowing problems
1 parent 563686a commit 288818f

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

include/args.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ struct subcommand
310310
template<class... Args>
311311
struct context
312312
{
313-
using subcommand = subcommand<Args...>;
314-
using subcommand_map = std::map<std::string, subcommand>;
313+
using subcommand_type = subcommand<Args...>;
314+
using subcommand_map = std::map<std::string, subcommand_type>;
315315
std::vector<argument> arguments;
316316
std::unordered_map<std::string, int> lookup;
317317
subcommand_map subcommands;
@@ -654,15 +654,15 @@ bool auto_register<T, F>::auto_register_reg_ = auto_register<T, F>::auto_registe
654654
template<class Derived>
655655
struct group
656656
{
657-
using context = context<Derived&>;
658-
using subcommand = typename context::subcommand;
659-
using subcommand_map = typename context::subcommand_map;
657+
using context_type = context<Derived&>;
658+
using subcommand_type = typename context_type::subcommand_type;
659+
using subcommand_map = typename context_type::subcommand_map;
660660
static subcommand_map subcommands;
661661

662662
template<class T>
663663
static void add_command()
664664
{
665-
subcommand sub;
665+
subcommand_type sub;
666666
sub.run = [](auto a, auto&&... xs)
667667
{
668668
parse<T>(a, xs...);

test/multi.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,63 +20,63 @@ struct multi_cmd
2020

2121
PROVE_CASE()
2222
{
23-
multi_cmd cmd;
23+
multi_cmd cmd{};
2424
args::parse(cmd, {"--verbose", "--flag"});
2525
PROVE_CHECK(cmd.verbose == true);
2626
PROVE_CHECK(cmd.flag == true);
2727
}
2828

2929
PROVE_CASE()
3030
{
31-
multi_cmd cmd;
31+
multi_cmd cmd{};
3232
args::parse(cmd, {"-v", "-f"});
3333
PROVE_CHECK(cmd.verbose == true);
3434
PROVE_CHECK(cmd.flag == true);
3535
}
3636

3737
PROVE_CASE()
3838
{
39-
multi_cmd cmd;
39+
multi_cmd cmd{};
4040
args::parse(cmd, {"--verbose", "-f"});
4141
PROVE_CHECK(cmd.verbose == true);
4242
PROVE_CHECK(cmd.flag == true);
4343
}
4444

4545
PROVE_CASE()
4646
{
47-
multi_cmd cmd;
47+
multi_cmd cmd{};
4848
args::parse(cmd, {"-v", "--flag"});
4949
PROVE_CHECK(cmd.verbose == true);
5050
PROVE_CHECK(cmd.flag == true);
5151
}
5252

5353
PROVE_CASE()
5454
{
55-
multi_cmd cmd;
55+
multi_cmd cmd{};
5656
args::parse(cmd, {"-v"});
5757
PROVE_CHECK(cmd.verbose == true);
5858
PROVE_CHECK(cmd.flag == false);
5959
}
6060

6161
PROVE_CASE()
6262
{
63-
multi_cmd cmd;
63+
multi_cmd cmd{};
6464
args::parse(cmd, {"-f"});
6565
PROVE_CHECK(cmd.verbose == false);
6666
PROVE_CHECK(cmd.flag == true);
6767
}
6868

6969
PROVE_CASE()
7070
{
71-
multi_cmd cmd;
71+
multi_cmd cmd{};
7272
args::parse(cmd, {"-vf"});
7373
PROVE_CHECK(cmd.verbose == true);
7474
PROVE_CHECK(cmd.flag == true);
7575
}
7676

7777
PROVE_CASE()
7878
{
79-
multi_cmd cmd;
79+
multi_cmd cmd{};
8080
args::parse(cmd, {"-qf"});
8181
PROVE_CHECK(cmd.verbose == false);
8282
PROVE_CHECK(cmd.flag == true);

0 commit comments

Comments
 (0)