[PATCH] PR libstdc++/89728 diagnose some missuses of [locale.convenience] functions

Antony Polukhin antoshkka@gmail.com
Wed May 12 09:58:16 GMT 2021


ср, 12 мая 2021 г. в 12:18, Jonathan Wakely <jwakely@redhat.com>:
<...>
> Or just leave it undefined, as libc++ seems to do according to your
> comment in PR 89728:
>
> error: implicit instantiation of undefined template 'std::__1::ctype<std::__1::basic_string<char> >'
>
> Was your aim to have a static_assert that gives a more descriptive
> error? We could leave it undefined in C++98 and have the static assert
> for C++11 and up.

Leaving it undefined would be the best. It would allow SFINAE on ctype
and a compile time error is informative enough.

However, there may be users who instantiate ctype<ThierChar> in a
shared library without ctype<ThierChar> template specializations in
the main executable. Making the default ctype undefined would break
their compilation:

#include <locale>
// no ctype<ThierChar> specialization
c = std::tolower(ThierChar{42}, locale_from_shared_library()); // OK
right now in libstdc++, fails on libc++


Should we care about those users?

-- 
Best regards,
Antony Polukhin


More information about the Libstdc++ mailing list