Skip to content

Commit 705d457

Browse files
committed
tests: Catch exceptions by const ref
To avoid "error: catching polymorphic type ‘class std::range_error’ by value"
1 parent d371427 commit 705d457

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

tests/test_exception_catch.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// -*- c++ -*-
21
/* Copyright 2002, The libsigc++ Development Team
32
* Assigned to public domain. Use as you wish without restriction.
43
*/
@@ -54,7 +53,7 @@ struct my_catch
5453
{
5554
throw;
5655
}
57-
catch (std::range_error e) // catch what types we know
56+
catch (const std::range_error& e) // catch what types we know
5857
{
5958
result_stream << "caught " << e.what();
6059
}

0 commit comments

Comments
 (0)