From: Jonathan Wakely <jwakely@redhat.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: gcc@gcc.gnu.org, libstdc++@gcc.gnu.org
Subject: Re: Deprecating arithmetic on std::atomic<void*>
Date: Thu, 20 Apr 2017 09:31:00 -0000 [thread overview]
Message-ID: <20170420093102.GE3412@redhat.com> (raw)
In-Reply-To: <520db01e-9e9c-333f-2537-e8be4fcd7d1e@redhat.com>
On 20/04/17 11:24 +0200, Florian Weimer wrote:
>On 04/20/2017 11:22 AM, Jonathan Wakely wrote:
>>On 20/04/17 10:18 +0100, Jonathan Wakely wrote:
>>>On 20/04/17 08:19 +0200, Florian Weimer wrote:
>>>>On 04/19/2017 07:07 PM, Jonathan Wakely wrote:
>>>>>I know it's a bit late, but I'd like to propose deprecating the
>>>>>libstdc++ extension that allows arithmetic on std::atomic<void*>.
>>>>>Currently we make it behave like arithmetic on void*, which is also a
>>>>>GNU extension (https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html).
>>>>>We also allow arithmetic on types such as std::atomic<void(*)()> which
>>>>>is probably not useful (PR 69769).
>>>>
>>>>Why is it acceptable to have the extension for built-in types,
>>>>but not for library types wrapping them? Why be inconsistent
>>>>about this?
>>>
>>>C++17 [atomic.types.pointer] paragraph 4 says:
>>>
>>>Requires: T shall be an object type, otherwise the program is
>>>ill-formed. [Note: Pointer arithmetic on void* or function pointers
>>>is ill-formed. â end note]
>>>
>>>That doesn't give us any leeway to support it.
>
>If we can ignore the Note, we can also ignore the requirement â¦
>
>>I suppose we could support it without -Wpedantic, although there's no
>>way for the library to know if the front-end is being pedantic or not.
>
>Could you use SFINAE to detect whether the compiler supports
>arithmetic on void *?
Probably. We'd have to move the relevant member functions into a new
base class in order to make them conditionally disabled.
next prev parent reply other threads:[~2017-04-20 9:31 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-19 17:07 Jonathan Wakely
2017-04-19 17:43 ` Ville Voutilainen
2017-04-20 6:19 ` Florian Weimer
2017-04-20 9:18 ` Jonathan Wakely
2017-04-20 9:21 ` Jakub Jelinek
2017-04-20 9:25 ` Jonathan Wakely
2017-04-20 9:30 ` Jonathan Wakely
2017-04-20 9:30 ` Jakub Jelinek
2017-04-20 9:43 ` Florian Weimer
2017-04-20 9:52 ` Jonathan Wakely
2017-04-20 9:57 ` Florian Weimer
2017-04-20 10:03 ` Jonathan Wakely
2017-04-20 10:07 ` Jakub Jelinek
2017-04-20 10:12 ` Jonathan Wakely
2017-04-20 11:20 ` Jonathan Wakely
2017-04-20 12:20 ` Jonathan Wakely
2017-04-20 9:22 ` Jonathan Wakely
2017-04-20 9:25 ` Florian Weimer
2017-04-20 9:31 ` Jonathan Wakely [this message]
2017-04-20 9:39 ` Jonathan Wakely
2017-04-20 9:49 ` Florian Weimer
2017-04-20 9:53 ` Jonathan Wakely
2017-04-20 11:29 ` Pedro Alves
2017-04-20 9:31 ` Marc Glisse
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=20170420093102.GE3412@redhat.com \
--to=jwakely@redhat.com \
--cc=fweimer@redhat.com \
--cc=gcc@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).