Skip to content

Commit 7b76e2b

Browse files
authored
Explicit type cast for the smart pointer tested with AlwaysAssert
Fixed a problem where AlwaysAssert macro does not like std::unique_ptr as an expression (#52) by adding an explicit type cast. Ideally, we should push this type cast into AlwaysAssert (and other assert macros) to make it easier using them with non-trivial types.
1 parent b87cffc commit 7b76e2b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

synthesis/Images/ADIOSImage.tcc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ void ADIOSImage<T>::restoreAll (const casacore::TableRecord& rec)
285285
// MV: I am not sure whether we're supposed to take the ownership of the returned raw pointer, but the original code
286286
// written with raw pointers did the equivalent thing
287287
std::unique_ptr<casacore::CoordinateSystem> restoredCoords(casacore::CoordinateSystem::restore(rec, "coords"));
288-
AlwaysAssert(restoredCoords, casacore::AipsError);
288+
const bool notNull = static_cast<bool>(restoredCoords);
289+
AlwaysAssert(notNull, casacore::AipsError);
289290
this->setCoordsMember(*restoredCoords);
290291
// Restore the image info.
291292
restoreImageInfo (rec);

0 commit comments

Comments
 (0)