Deprecating arithmetic on std::atomic<void*>

Jonathan Wakely jwakely@redhat.com
Wed Apr 19 17:07:00 GMT 2017


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).

C++11 and C++14 were silent on the matter, but C++17 makes it
explicitly ill-formed (see https://wg21.link/p0558r1 page 2). I'm
implementing that for C++17 mode but would like it to be ill-formed
for all modes in a future release.

So I'd like to apply this patch to the gcc-7/changes.html page:

--- htdocs/gcc-7/changes.html   17 Apr 2017 22:12:35 -0000      1.77                                                                                                                                              
+++ htdocs/gcc-7/changes.html   19 Apr 2017 17:05:27 -0000                                                                                                                                                        
@@ -38,6 +38,10 @@
   </li>
 
   <li>The Cilk+ extensions to the C and C++ languages have been deprecated.</li>
+
+  <li>The extension allowing arithmetic on <code>std::atomic<void*></code>
+      and types like <code>std::atomic<R(*)()></code>
+      has been deprecated.</li>
 </ul>
 
 <!-- .................................................................. -->


Does this seem reasonable, or do people think we need to keep this
feature, to match the core language extensions?



More information about the Libstdc++ mailing list