From d83e9ea05fdb2e703a4a7df23c9acf53d76e75c1 Mon Sep 17 00:00:00 2001 From: Herb Sutter Date: Thu, 17 Dec 2020 12:11:42 -0800 Subject: [PATCH] Add workarounds for Android compiler and `constexpr` test --- include/gsl/assert | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/gsl/assert b/include/gsl/assert index 1c2d96e..1fc611d 100644 --- a/include/gsl/assert +++ b/include/gsl/assert @@ -102,18 +102,18 @@ namespace details class contract_group { public: - using handler = void (*)() noexcept; + using handler = void (*)() /*noexcept*/; // TODO: make this noexcept once all supported compilers allow it - contract_group(handler h) { set_handler(h); } + constexpr contract_group(handler h) { set_handler(h); } auto set_handler(handler h) -> handler { if (!h) h = []()noexcept{}; return chandler.exchange(h); } auto get_handler() -> handler { return chandler; } - void expects(bool b) { assertion(b); } - void ensures(bool b) { assertion(b); } + constexpr void expects(bool b) { assertion(b); } + constexpr void ensures(bool b) { assertion(b); } private: - void assertion(bool b) { if (!b) chandler.load()(); } + constexpr void assertion(bool b) { if (!b) chandler.load()(); } std::atomic chandler; };