diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h index 03724cf..5ca431e 100644 --- a/libstdc++-v3/include/bits/locale_facets.h +++ b/libstdc++-v3/include/bits/locale_facets.h @@ -671,6 +671,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template locale::id ctype<_CharT>::id; + // Incomplete to provide a compile time diagnostics for common misuse + // of [locale.convenience] functions with basic_string as a character type. + template + class ctype >; + /** * @brief The ctype specialization. * @ingroup locales diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/string/89728_neg.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/string/89728_neg.cc new file mode 100644 index 0000000..9f15620 --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/ctype/is/string/89728_neg.cc @@ -0,0 +1,73 @@ +// { dg-do compile } + +// Copyright (C) 2021 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-error "complete" "" { target *-*-* } 0 } + +#include + +template +struct trait: std::char_traits {}; + +template +std::basic_string > make_str() +{ + return std::basic_string >(); +} + +void test01() +{ + const std::locale& loc = std::locale::classic(); + + std::isspace(std::string(), loc); // { dg-error "required from here" } + std::isprint(make_str(), loc); // { dg-error "required from here" } + std::iscntrl(make_str(), loc); // { dg-error "required from here" } + std::isupper(make_str(), loc); // { dg-error "required from here" } + std::islower(make_str(), loc); // { dg-error "required from here" } + std::isalpha(make_str(), loc); // { dg-error "required from here" } + std::isdigit(make_str(), loc); // { dg-error "required from here" } + std::ispunct(make_str(), loc); // { dg-error "required from here" } + std::isxdigit(make_str(), loc); // { dg-error "required from here" } + std::isalnum(make_str(), loc); // { dg-error "required from here" } + std::isgraph(make_str(), loc); // { dg-error "required from here" } + std::isblank(make_str(), loc); // { dg-error "required from here" } + std::toupper(make_str(), loc); // { dg-error "required from here" } + std::tolower(make_str(), loc); // { dg-error "required from here" } +} + +#ifdef _GLIBCXX_USE_WCHAR_T +void test02() +{ + const std::locale& loc = std::locale::classic(); + + std::isspace(std::wstring(), loc); // { dg-error "required from here" } + std::isprint(make_str(), loc); // { dg-error "required from here" } + std::iscntrl(make_str(), loc); // { dg-error "required from here" } + std::isupper(make_str(), loc); // { dg-error "required from here" } + std::islower(make_str(), loc); // { dg-error "required from here" } + std::isalpha(make_str(), loc); // { dg-error "required from here" } + std::isdigit(make_str(), loc); // { dg-error "required from here" } + std::ispunct(make_str(), loc); // { dg-error "required from here" } + std::isxdigit(make_str(), loc); // { dg-error "required from here" } + std::isalnum(make_str(), loc); // { dg-error "required from here" } + std::isgraph(make_str(), loc); // { dg-error "required from here" } + std::isblank(make_str(), loc); // { dg-error "required from here" } + std::toupper(make_str(), loc); // { dg-error "required from here" } + std::tolower(make_str(), loc); // { dg-error "required from here" } +} +#endif