public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joseph Faulls <Joseph.Faulls@imgtec.com>
To: "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: "jwakely@redhat.com" <jwakely@redhat.com>
Subject: [PATCH] libstdc++: Do not assume existence of char8_t codecvt facet
Date: Fri, 2 Jun 2023 15:44:48 +0000	[thread overview]
Message-ID: <LO4P265MB5914451ED93CD4B7617714A0804EA@LO4P265MB5914.GBRP265.PROD.OUTLOOK.COM> (raw)

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

It is not required that codecvt<char8_t, char, mbstate_t> facet be supported by
the locale, nor is it added as part of the default locale. This can lead to
dangerous behaviour when static_cast.

libstdc++-v3/ChangeLog:

        * include/bits/locale_classes.tcc: Remove check.
---
libstdc++-v3/include/bits/locale_classes.tcc | 3 ---
1 file changed, 3 deletions(-)

diff --git a/libstdc++-v3/include/bits/locale_classes.tcc b/libstdc++-v3/include/bits/locale_classes.tcc
index 94838cd7796..2351dd5bcfb 100644
--- a/libstdc++-v3/include/bits/locale_classes.tcc
+++ b/libstdc++-v3/include/bits/locale_classes.tcc
@@ -129,9 +129,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _GLIBCXX_STD_FACET(time_put<wchar_t>);
       _GLIBCXX_STD_FACET(messages<wchar_t>);
#endif
-#ifdef _GLIBCXX_USE_CHAR8_T
-      _GLIBCXX_STD_FACET(codecvt<char8_t, char, mbstate_t>);
-#endif
#if __cplusplus >= 201103L
       _GLIBCXX_STD_FACET(codecvt<char16_t, char, mbstate_t>);
       _GLIBCXX_STD_FACET(codecvt<char32_t, char, mbstate_t>);
--
2.34.1

             reply	other threads:[~2023-06-02 15:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02 15:44 Joseph Faulls [this message]
2023-06-02 16:52 ` Jonathan Wakely
2023-06-06 11:45   ` Jonathan Wakely

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=LO4P265MB5914451ED93CD4B7617714A0804EA@LO4P265MB5914.GBRP265.PROD.OUTLOOK.COM \
    --to=joseph.faulls@imgtec.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --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).