diff options
author | Andres Noetzli <andres.noetzli@gmail.com> | 2018-10-02 10:28:38 -0700 |
---|---|---|
committer | Aina Niemetz <aina.niemetz@gmail.com> | 2018-10-02 10:28:38 -0700 |
commit | 8519233cec9501f31aa1789eff60cb802c8df450 (patch) | |
tree | 60c87d9fe4c59ac565b3fdd66710229f58bc6a44 /test/unit/expr/symbol_table_black.h | |
parent | 64a0e3f1e4a5a8e3070eeadae0f6942b290c2974 (diff) |
Fix "catching polymorphic type by value" warnings (#2556)
When using the `TS_ASSERT_THROWS` marco from CxxTest, we have to make
sure that we use a reference type for the exception, otherwise the unit
test tries to catch the exception by value, resulting in "catching
polymorphic type by value" warnings.
Diffstat (limited to 'test/unit/expr/symbol_table_black.h')
-rw-r--r-- | test/unit/expr/symbol_table_black.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/unit/expr/symbol_table_black.h b/test/unit/expr/symbol_table_black.h index 2f6f88c27..99799544f 100644 --- a/test/unit/expr/symbol_table_black.h +++ b/test/unit/expr/symbol_table_black.h @@ -44,7 +44,7 @@ private: { d_exprManager = new ExprManager; } - catch (Exception e) + catch (Exception& e) { cerr << "Exception during setUp():" << endl << e; throw; @@ -55,7 +55,9 @@ private: { try { delete d_exprManager; - } catch(Exception e) { + } + catch (Exception& e) + { cerr << "Exception during tearDown():" << endl << e; throw; } @@ -160,6 +162,6 @@ private: void testBadPop() { SymbolTable symtab; // TODO: What kind of exception gets thrown here? - TS_ASSERT_THROWS( symtab.popScope(), ScopeException ); + TS_ASSERT_THROWS(symtab.popScope(), ScopeException&); } };/* class SymbolTableBlack */ |