From 23a899cf0ebcb95223a269479f307927561baeaa Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 5 May 2018 22:33:55 +0000 Subject: [PATCH] Adjust valptridx for clang static_assert limitation valptridx contains `static_assert` statements of the form: static_assert(var.m, ""); where `var` is a non-`constexpr` reference and `m` is a `static constexpr` member of a base type of `var`. gcc recognizes that a `static constexpr` member is a constant expression and permits this. clang rejects this, presumably because `var` is not a `constexpr` variable. In the almost 3 years since this was added, clang has not improved to permit this usage. Rather than continuing to suppress static_assert in clang, rewrite this expression to be less clear, but be compatible with clang. --- common/include/valptridx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/include/valptridx.h b/common/include/valptridx.h index aa56f21c3..5b4d42106 100644 --- a/common/include/valptridx.h +++ b/common/include/valptridx.h @@ -353,7 +353,7 @@ public: * right hand side must be saved and checked for validity before * being used to initialize a require_valid type. */ - static_assert(allow_nullptr || !rhs.allow_nullptr, "cannot move from allow_invalid to require_valid"); + static_assert(policy::allow_nullptr || !rpolicy::allow_nullptr, "cannot move from allow_invalid to require_valid"); } idx(index_type i DXX_VALPTRIDX_REPORT_STANDARD_LEADER_COMMA_L_DECL_VARS) : m_idx(check_allowed_invalid_index(i) ? i : check_index_range>(DXX_VALPTRIDX_REPORT_STANDARD_LEADER_COMMA_R_PASS_VARS i, nullptr)) @@ -489,7 +489,7 @@ public: * right hand side must be saved and checked for validity before * being used to initialize a require_valid type. */ - static_assert(allow_nullptr || !rhs.allow_nullptr, "cannot move from allow_invalid to require_valid"); + static_assert(policy::allow_nullptr || !rpolicy::allow_nullptr, "cannot move from allow_invalid to require_valid"); } ptr(index_type i) = delete; ptr(DXX_VALPTRIDX_REPORT_STANDARD_LEADER_COMMA_R_DEFN_VARS index_type i, array_managed_type &a) :