Skip to content

[libc++] No library support for char8_t if compiled without C++20 but with -fchar8_t #97601

Closed as not planned
@MitalAshok

Description

@MitalAshok

Currently, _LIBCPP_HAS_NO_CHAR8_T is always defined if not compiled with -std=c++20 or above:

# if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t)
# define _LIBCPP_HAS_NO_CHAR8_T
# endif

But both Clang and GCC allow char8_t in older standards with the -fchar8_t flag: https://godbolt.org/z/ePcrqvWsa

Someone specifying -fchar8_t presumably is going to use char8_t consistently even before C++20, so it makes sense to allow using library facilities for char8_t. One problem I can think of is that some names (like u8string) aren't reserved in C++17, but someone using -fchar8_t should know not to use them. Plus libstdc++ supports it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.wontfixIssue is real, but we can't or won't fix it. Not invalid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions