diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-09-16 15:40:06 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-09-16 15:54:42 +0100 |
commit | b6adc6255f527edd50c08c4aacb4ee21df1c349c (patch) | |
tree | a8313e0e492b227698294727a138e8ddd46ed705 /gcc/cp/constexpr.cc | |
parent | 5ad435f2a0d29486c917025dfa239b9b88c35a09 (diff) | |
download | gcc-b6adc6255f527edd50c08c4aacb4ee21df1c349c.zip gcc-b6adc6255f527edd50c08c4aacb4ee21df1c349c.tar.gz gcc-b6adc6255f527edd50c08c4aacb4ee21df1c349c.tar.bz2 |
libstdc++: Fix tr1::variate_generator::engine_value_type
The tr1/5_numerical_facilities/random/variate_generator/37986.cc test
fails for strict -std=c++98 mode because _Adaptor(const _Engine&) is
ill-formed in C++98 when _Engine is a reference type.
Rather than attempt to make the _Adaptor handle references and pointers,
just strip references and pointers from the _Engine type before we adapt
it. That removes the need for the _Adaptor<_Engine*> partial
specialization and avoids the reference-to-reference problem for c++98
mode.
While looking into this I noticed that the TR1 spec requires the
variate_generator<E,D>::engine_value_type to be the underlying engine
type, whereas we make it the _Adaptor<E> type that wraps the engine.
libstdc++-v3/ChangeLog:
* include/tr1/random.h (__detail::_Adaptor::_BEngine): Remove.
(__detail::_Adaptor::_M_g): Make public.
(__detail::_Adaptor<_Engine*, _Dist>): Remove partial
specialization.
(variate_generate::_Value): New helper to simplify handling of
_Engine* and _Engine& template arguments.
(variate_generate::engine_value_type): Define to underlying
engine type, not adapted type.
(variate_generate::engine()): Return underlying engine instead
of adaptor.
* testsuite/tr1/5_numerical_facilities/random/variate_generator/37986.cc:
Fix comment.
* testsuite/tr1/5_numerical_facilities/random/variate_generator/requirements/typedefs.cc:
Check member typedefs have the correct types.
Diffstat (limited to 'gcc/cp/constexpr.cc')
0 files changed, 0 insertions, 0 deletions