From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [PATCH] Remove reundant const-qualification from cast targets
Date: Thu, 27 Apr 2017 15:45:00 -0000 [thread overview]
Message-ID: <20170427151647.GA18051@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 562 bytes --]
static_cast<T const> and const_cast<T const> are meaningless when T is
not a class type, because the result is a prvalue and prvalues of
non-class type are unqualified. I'm removing these pointless
const-qualifications now, because I'm experimenting with a patch to
make the front-end warn about this.
* include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
(PB_DS_CLASS_C_DEC::end()): Remove redundant const in cast type.
* testsuite/util/testsuite_rng.h (twister_rand_gen::get_prob()):
Likewise.
Tested powerpc64le-linux, committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1768 bytes --]
commit e660629ac73bae7caf3e85d95cdfc6dc9d40f27a
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Apr 27 15:50:41 2017 +0100
Remove reundant const qualification from cast targets
* include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
(PB_DS_CLASS_C_DEC::end()): Remove redundant const in cast type.
* testsuite/util/testsuite_rng.h (twister_rand_gen::get_prob()):
Likewise.
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
index 91fef51..a1b6ed5 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
@@ -75,6 +75,6 @@ inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
end() const
{
- return const_iterator(0, 0, const_cast<PB_DS_CLASS_C_DEC* const>(this));
+ return const_iterator(0, 0, const_cast<PB_DS_CLASS_C_DEC*>(this));
}
diff --git a/libstdc++-v3/testsuite/util/testsuite_rng.h b/libstdc++-v3/testsuite/util/testsuite_rng.h
index fd232fc..84fa750 100644
--- a/libstdc++-v3/testsuite/util/testsuite_rng.h
+++ b/libstdc++-v3/testsuite/util/testsuite_rng.h
@@ -79,8 +79,8 @@ namespace __gnu_pbds
{
const double min = m_base_generator.min();
const double max = m_base_generator.max();
- const double range = static_cast<const double>(max - min);
- const double res = static_cast<const double>(m_base_generator() - min);
+ const double range = static_cast<double>(max - min);
+ const double res = static_cast<double>(m_base_generator() - min);
const double ret = res / range;
_GLIBCXX_DEBUG_ASSERT(ret >= 0 && ret <= 1);
return ret;
reply other threads:[~2017-04-27 15:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170427151647.GA18051@redhat.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).