public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/98725] New: Review what is disabled in libstdc++ by --disable-wchar_t
@ 2021-01-18 11:08 redi at gcc dot gnu.org
  2021-01-18 14:23 ` [Bug libstdc++/98725] " cvs-commit at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2021-01-18 11:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98725

            Bug ID: 98725
           Summary: Review what is disabled in libstdc++ by
                    --disable-wchar_t
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

Currently libstdc++ guards *any* use of wchar_t with a check for
_GLIBCXX_USE_WCHAR_T. This has unfortunate consequences such as
std::wstring_convert being unusable to convert between char and char16_t (which
doesn't use wchar_t at all). That's because we do this in <bits/locale_conv.h>:

 #ifdef _GLIBCXX_USE_WCHAR_T

 _GLIBCXX_BEGIN_NAMESPACE_CXX11

   /// String conversions
   template<typename _Codecvt, typename _Elem = wchar_t,
           typename _Wide_alloc = allocator<_Elem>,
           typename _Byte_alloc = allocator<char>>
     class wstring_convert


The wchar_t type exists unconditionally for C++, so traits like
std::is_integral_v<wchar_t> are already always defined as true.
std::char_traits<wchar_t> also works, by using the primary template (which
works for any character-like type). That means that even std::wstring works,
albeit slower than if we had optimized support for <wchar.h> in libc.

The consequences of --disable-wchar_t (whether implicit or explicit) should to
disable explicit instantiations for std::wstring, std::wifstream etc. and to
disable wchar_t support in locales and std::filesystem. It doesn't need to
disable everything that refers to wchar_t.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-11-24 11:51 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-18 11:08 [Bug libstdc++/98725] New: Review what is disabled in libstdc++ by --disable-wchar_t redi at gcc dot gnu.org
2021-01-18 14:23 ` [Bug libstdc++/98725] " cvs-commit at gcc dot gnu.org
2021-01-18 14:24 ` redi at gcc dot gnu.org
2021-04-19 10:40 ` redi at gcc dot gnu.org
2021-10-08 12:03 ` redi at gcc dot gnu.org
2021-10-08 14:08 ` redi at gcc dot gnu.org
2021-10-08 14:48 ` redi at gcc dot gnu.org
2021-10-08 14:51 ` cvs-commit at gcc dot gnu.org
2021-10-08 19:12 ` redi at gcc dot gnu.org
2021-10-08 23:31 ` redi at gcc dot gnu.org
2021-10-09  0:15 ` cvs-commit at gcc dot gnu.org
2021-10-09  0:15 ` cvs-commit at gcc dot gnu.org
2021-10-09  0:15 ` cvs-commit at gcc dot gnu.org
2021-10-09  0:15 ` cvs-commit at gcc dot gnu.org
2021-10-09  0:15 ` cvs-commit at gcc dot gnu.org
2021-10-09  0:15 ` cvs-commit at gcc dot gnu.org
2021-10-09  0:16 ` redi at gcc dot gnu.org
2021-11-24 11:51 ` cvs-commit at gcc dot gnu.org

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