Skip to content

Commit 89be4c9

Browse files
authored
Merge pull request #3352 from tautschnig/vs-result
Do not shadow the "result" variable and fix one use of it [blocks: #2310]
2 parents 9a81e2b + 6990e03 commit 89be4c9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

unit/util/symbol_table.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ SCENARIO("journalling_symbol_table_writer",
6969
}
7070
WHEN("Adding the same symbol again")
7171
{
72-
auto result=symbol_table.insert(symbol);
72+
const auto result_re_insert = symbol_table.insert(symbol);
7373
THEN("The insert should fail")
7474
{
75-
REQUIRE(!result.second);
75+
REQUIRE(!result_re_insert.second);
7676
}
7777
}
7878
}
@@ -106,10 +106,10 @@ SCENARIO("journalling_symbol_table_writer",
106106
WHEN("Moving the same symbol again")
107107
{
108108
symbolt *symbol_in_table2;
109-
auto result=symbol_table.move(symbol, symbol_in_table2);
109+
const auto result_move = symbol_table.move(symbol, symbol_in_table2);
110110
THEN("The move should fail")
111111
{
112-
REQUIRE(result);
112+
REQUIRE(result_move);
113113
}
114114
THEN("The returned pointer should match the previous move result")
115115
{
@@ -145,10 +145,10 @@ SCENARIO("journalling_symbol_table_writer",
145145
}
146146
WHEN("Adding the same symbol again")
147147
{
148-
auto result=symbol_table.add(symbol);
148+
auto result_add_2 = symbol_table.add(symbol);
149149
THEN("The insert should fail")
150150
{
151-
REQUIRE(result);
151+
REQUIRE(result_add_2);
152152
}
153153
}
154154
}
@@ -259,16 +259,16 @@ SCENARIO("journalling_symbol_table_writer",
259259
{
260260
symbolt symbol;
261261
symbol.name = symbol_name;
262-
auto result=symbol_table.add(symbol);
262+
const auto result_add_1 = symbol_table.add(symbol);
263263
symbol_table.remove(symbol.name);
264-
auto result2=symbol_table.add(symbol);
264+
const auto result_add_2 = symbol_table.add(symbol);
265265
THEN("The first add should succeed")
266266
{
267-
REQUIRE(!result);
267+
REQUIRE(!result_add_1);
268268
}
269269
THEN("The second add should succeed")
270270
{
271-
REQUIRE(!result);
271+
REQUIRE(!result_add_2);
272272
}
273273
THEN("The symbol should be journalled as updated but not removed")
274274
{

0 commit comments

Comments
 (0)