summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2022-05-06 21:37:47 +0100
committerJonathan Wakely <jwakely@redhat.com>2022-05-06 23:54:09 +0100
commit42991a911685a419794c47eba640d35ca60c2d99 (patch)
tree8cf0c1c4a117fff9ce2c1d90b96480ee65d55d67 /libstdc++-v3/include
parent909ef4e2727ddc50a32d6ad379a1f1ccc1043c6a (diff)
downloadgcc-42991a911685a419794c47eba640d35ca60c2d99.tar.gz
libstdc++: Simplify std::normal_distribution equality operator
libstdc++-v3/ChangeLog: * include/bits/random.tcc (operator==): Only check normal_distribution::_M_saved_available once. * testsuite/26_numerics/random/normal_distribution/operators/equal.cc: Check equality after state changes. * testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error lineno.
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/bits/random.tcc10
1 files changed, 1 insertions, 9 deletions
diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc
index 87a16a21336..cb1d3675783 100644
--- a/libstdc++-v3/include/bits/random.tcc
+++ b/libstdc++-v3/include/bits/random.tcc
@@ -1907,15 +1907,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
if (__d1._M_param == __d2._M_param
&& __d1._M_saved_available == __d2._M_saved_available)
- {
- if (__d1._M_saved_available
- && __d1._M_saved == __d2._M_saved)
- return true;
- else if(!__d1._M_saved_available)
- return true;
- else
- return false;
- }
+ return __d1._M_saved_available ? __d1._M_saved == __d2._M_saved : true;
else
return false;
}