Skip to content

Commit 9e40fc8

Browse files
nyhwkozaczuk
authored andcommitted
tests: fix compilation warning in tests/tst-run.cc
It is generally a bad idea to catch exceptions by value, because it forces an unnecessary copy of the caught value. It's even worse when the type is polymorphic - in that case the copy will only be a slice of the original type. This is why recent compilers started to warn when code catches a polymorphic type by value. In the specific case fixed here, the warning is spurious, because the caught exception isn't even used. But it's trivial to fix it, and get rid of one more warning during test compilation. Refs #976 Signed-off-by: Nadav Har'El <[email protected]> Message-Id: <[email protected]>
1 parent 0edc01a commit 9e40fc8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/tst-run.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int main(int ac, char** av)
4444
osv::run("/nonexistant.so", 0, nullptr, nullptr);
4545
// should throw and not get here
4646
report(false, "Run nonexistant");
47-
} catch(osv::launch_error) {
47+
} catch(osv::launch_error&) {
4848
report(true, "Run nonexistant");
4949
}
5050

0 commit comments

Comments
 (0)