public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Use deleted functions to make std::locale::facet non-copyable
@ 2015-05-01 16:51 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2015-05-01 16:51 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 244 bytes --]

Replace the private & unimplemented idiom with deleted functions when
available. This gives slightly better error messages (as well as
stricter conformance to the precise wording of the standard).

Tested powerpc64le-linux, committed to trunk.

[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1134 bytes --]

commit dd256f9035b4e32f1bb53eaf82919b0b69c6c999
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri May 1 17:35:26 2015 +0100

    	* include/bits/locale_classes.h (locale::facet): Delete copy
    	operations in C++11 mode.

diff --git a/libstdc++-v3/include/bits/locale_classes.h b/libstdc++-v3/include/bits/locale_classes.h
index f3898eb..7e098e3 100644
--- a/libstdc++-v3/include/bits/locale_classes.h
+++ b/libstdc++-v3/include/bits/locale_classes.h
@@ -428,6 +428,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     _GLIBCXX_CONST static const char*
     _S_get_c_name() throw();
 
+#if __cplusplus < 201103L
+  private:
+    facet(const facet&);  // Not defined.
+
+    facet&
+    operator=(const facet&);  // Not defined.
+#else
+    facet(const facet&) = delete;
+
+    facet&
+    operator=(const facet&) = delete;
+#endif
+
   private:
     void
     _M_add_reference() const throw()
@@ -448,11 +461,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	}
     }
 
-    facet(const facet&);  // Not defined.
-
-    facet&
-    operator=(const facet&);  // Not defined.
-
     class __shim;
 
     const facet* _M_sso_shim(const id*) const;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-05-01 16:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-01 16:51 [patch] Use deleted functions to make std::locale::facet non-copyable Jonathan Wakely

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