From: Jonathan Wakely Date: Wed, 30 Jun 2021 14:47:41 +0000 (+0100) Subject: libstdc++: Suppress redundant definitions of static members in X-Git-Tag: upstream/12.2.0~6756 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=996be6b670b9f85727a6ae98c8095ca9cfbc0f67;p=platform%2Fupstream%2Fgcc.git libstdc++: Suppress redundant definitions of static members in Since C++17 the static members of the random number engines are implicitly inline, so don't need definitions. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/random.tcc [__cpp_inline_variables]: Remove redundant definitions of static constexpr member variables. * testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error line number. --- diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc index 8e2b702..f28163e 100644 --- a/libstdc++-v3/include/bits/random.tcc +++ b/libstdc++-v3/include/bits/random.tcc @@ -186,7 +186,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __is; } - +#if ! __cpp_inline_variables template::default_seed; +#endif template constexpr size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size; @@ -531,6 +532,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template constexpr _UIntType subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed; +#endif template void @@ -666,7 +668,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __is; } - +#if ! __cpp_inline_variables template constexpr size_t discard_block_engine<_RandomNumberEngine, __p, __r>::block_size; @@ -674,6 +676,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template constexpr size_t discard_block_engine<_RandomNumberEngine, __p, __r>::used_block; +#endif template typename discard_block_engine<_RandomNumberEngine, @@ -799,10 +802,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __sum; } - +#if ! __cpp_inline_variables template constexpr size_t shuffle_order_engine<_RandomNumberEngine, __k>::table_size; +#endif namespace __detail { diff --git a/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc b/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc index ba252ef..ae03b56 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc @@ -12,4 +12,4 @@ auto x = std::generate_canonical