diff mbox series

[v3] PATCH to make _BracketMatcher::_S_cache_size a variable

Message ID CADzB+2nPOjk5wj99pG5LCCz1HxFuSZe2bgf4DEEycbYegQ1pOg@mail.gmail.com
State New
Headers show
Series [v3] PATCH to make _BracketMatcher::_S_cache_size a variable | expand

Commit Message

Jason Merrill May 10, 2018, 5:59 p.m. UTC
There doesn't seem to be any reason for _S_cache_size to be a function
rather than a variable.  OK for trunk?

Comments

Jonathan Wakely May 10, 2018, 7:08 p.m. UTC | #1
On 10/05/18 13:59 -0400, Jason Merrill wrote:
>There doesn't seem to be any reason for _S_cache_size to be a function
>rather than a variable.  OK for trunk?

I vaguely recall some problem with that constant, maybe it didn't work
as a variable once upon a time. If that was ever true it was fixed
long ago so the change is OK, thanks.
diff mbox series

Patch

commit bf6843a87d3f64c9ffa29ce8d50aaa6fe8aabcfa
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Mar 14 21:39:06 2018 -0400

            * include/bits/regex_compiler.h (_S_cache_size): Change from
            function to variable.

diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h
index 7e5c2073554..6eee9cb9072 100644
--- a/libstdc++-v3/include/bits/regex_compiler.h
+++ b/libstdc++-v3/include/bits/regex_compiler.h
@@ -527,14 +527,12 @@  namespace __detail
       typedef typename std::is_same<_CharT, char>::type _UseCache;
 
       static constexpr size_t
-      _S_cache_size()
-      {
-	return 1ul << (sizeof(_CharT) * __CHAR_BIT__ * int(_UseCache::value));
-      }
+      _S_cache_size =
+	1ul << (sizeof(_CharT) * __CHAR_BIT__ * int(_UseCache::value));
 
       struct _Dummy { };
       typedef typename std::conditional<_UseCache::value,
-					std::bitset<_S_cache_size()>,
+					std::bitset<_S_cache_size>,
 					_Dummy>::type _CacheT;
       typedef typename std::make_unsigned<_CharT>::type _UnsignedCharT;