From 63b39e275846896083ab11721b5aae5c806bdcbc Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 21 May 2017 11:41:04 +0100 Subject: [PATCH] Enhance thread_local tests. Try to reproduce issues: https://github.com/libbitcoin/libbitcoin/issues/733#issuecomment-301652210 https://github.com/boostorg/multiprecision/issues/20 --- test/boost_no_cxx11_thread_local.ipp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/boost_no_cxx11_thread_local.ipp b/test/boost_no_cxx11_thread_local.ipp index 795ee746..caaed978 100644 --- a/test/boost_no_cxx11_thread_local.ipp +++ b/test/boost_no_cxx11_thread_local.ipp @@ -14,10 +14,22 @@ namespace boost_no_cxx11_thread_local{ +template +int check_local(int n) +{ + static thread_local T s(n, ' '); + static thread_local int size = s.size(); + if(size != n) + { + s = T(n, ' '); + size = n; + } + return size; +} + int test() { - static thread_local std::string local("hello"); - return 0; + return check_local(5) == 5 ? 0 : 1; } }