Skip to content

Commit 1585954

Browse files
committed
tests: Catch exceptions by const ref.
Noticed by cppcheck.
1 parent 6175d5d commit 1585954

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/test_exception_catch.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct my_catch
5353
{
5454
throw;
5555
}
56-
catch (std::range_error e) // catch what types we know
56+
catch (const std::range_error& e) // catch what types we know
5757
{
5858
result_stream << "caught " << e.what();
5959
}
@@ -70,7 +70,7 @@ struct my_catch_void
7070
{
7171
throw;
7272
}
73-
catch (std::range_error e) // catch what types we know
73+
catch (const std::range_error& e) // catch what types we know
7474
{
7575
result_stream << "caught " << e.what();
7676
}

0 commit comments

Comments
 (0)