-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Hi,
The Orm::Exceptions::MultipleColumnsSelectedError exception class is not marked for dllexport. If tinyorm is compiled with -fvisibility=hidden
, the exception class will therefore not be visible outside of the tinyorm dll.
The tst_DatabaseConnection::scalar_MultipleColumnsSelectedError()
unit test requires an instance of MultipleColumnsSelectedError to be thrown. As the exception class instanciated inside the dll doesn't export it's vtable through the dll interface, an equally named class outside the dll domain will be incompatible in terms of type deduction, and therefore the exception can not be caught on its own name:
...
FAIL! : tst_DatabaseConnection::scalar_MultipleColumnsSelectedError(tinyorm_sqlite_tests) Expected an exception of type MultipleColumnsSelectedError to be thrown, but caught std::exception with message 2 columns were selected in DatabaseConnection::scalar(), select only one column with the scalar() method.
Loc: [/tmp/TinyORM-0.38.1/tests/auto/unit/orm/databaseconnection/tst_databaseconnection.cpp(871)]
The test passes if it is modified to validate an instance of the parent class (Orm::Exceptions::RuntimeError
, which is exported) is thrown, or if Orm::Exceptions::MultipleColumnsSelectedError
is exported by decorating it with TINYORM_EXPORT
.