From bf4a103ea93aed3018942f53aeef8238c33583fb Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 12 Oct 2017 11:04:08 +0100 Subject: [PATCH] Make a few changes suggested by @smowton --- src/util/expr_cast.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/util/expr_cast.h b/src/util/expr_cast.h index 862e764bda8..5c2337930d2 100644 --- a/src/util/expr_cast.h +++ b/src/util/expr_cast.h @@ -27,7 +27,7 @@ Author: Nathan Phillips /// \tparam T The exprt-derived class to check for /// \param base Reference to a generic \ref exprt /// \return true if \a base is of type \a T -template bool can_cast_expr(const exprt &base); +template inline bool can_cast_expr(const exprt &base); /// Called after casting. Provides a point to assert on the structure of the /// expr. By default, this is a no-op, but you can provide an overload to @@ -45,7 +45,8 @@ struct expr_try_dynamic_cast_return_typet final { static_assert( !std::is_reference::value, - "Ret must be non-qualified"); + "Ret must not be a reference, i.e. expr_try_dynamic_cast " + "rather than expr_try_dynamic_cast"); typedef typename std::conditional< @@ -78,7 +79,7 @@ auto expr_try_dynamic_cast(TExpr &base) static_assert( std::is_base_of::value, "The template argument T must be derived from exprt."); - if(!can_cast_expr(base)) + if(!can_cast_expr::type>(base)) return nullptr; const auto ret=static_cast(&base); validate_expr(*ret); @@ -93,7 +94,8 @@ struct expr_dynamic_cast_return_typet final { static_assert( !std::is_reference::value, - "Ret must be non-qualified"); + "Ret must not be a reference, i.e. expr_dynamic_cast rather " + "than expr_dynamic_cast"); typedef typename std::conditional<