]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/22_locale/ctype/is/string/89728_neg.cc
3 // Copyright (C) 2021-2023 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
20 // { dg-error "invalid use of incomplete type" "" { target *-*-* } 0 }
21 // { dg-error "invalid 'static_cast'" "" { target c++98_only } 0 }
25 template <class Char
, int I
>
26 struct trait
: std::char_traits
<Char
> {};
28 // Generates unique types so we get distinct diagnostics for each line.
29 template <class Char
, int I
>
30 std::basic_string
<Char
, trait
<Char
, I
> > make_str()
32 return std::basic_string
<Char
, trait
<Char
, I
> >();
37 const std::locale
& loc
= std::locale::classic();
39 std::isspace(std::string(), loc
); // { dg-error "required from here" }
40 std::isprint(make_str
<char, 0>(), loc
); // { dg-error "required from here" }
41 std::iscntrl(make_str
<char, 1>(), loc
); // { dg-error "required from here" }
42 std::isupper(make_str
<char, 2>(), loc
); // { dg-error "required from here" }
43 std::islower(make_str
<char, 3>(), loc
); // { dg-error "required from here" }
44 std::isalpha(make_str
<char, 4>(), loc
); // { dg-error "required from here" }
45 std::isdigit(make_str
<char, 5>(), loc
); // { dg-error "required from here" }
46 std::ispunct(make_str
<char, 6>(), loc
); // { dg-error "required from here" }
47 std::isxdigit(make_str
<char, 7>(), loc
); // { dg-error "required from here" }
48 std::isalnum(make_str
<char, 8>(), loc
); // { dg-error "required from here" }
49 std::isgraph(make_str
<char, 9>(), loc
); // { dg-error "required from here" }
50 #if __cplusplus >= 201103
51 std::isblank(make_str
<char, 10>(), loc
); // { dg-error "required from here" "" { target c++11 } }
53 std::toupper(make_str
<char, 11>(), loc
); // { dg-error "required from here" }
54 std::tolower(make_str
<char, 12>(), loc
); // { dg-error "required from here" }
59 const std::locale
& loc
= std::locale::classic();
61 std::isspace(std::wstring(), loc
); // { dg-error "required from here" }
62 std::isprint(make_str
<wchar_t, 0>(), loc
); // { dg-error "required from here" }
63 std::iscntrl(make_str
<wchar_t, 1>(), loc
); // { dg-error "required from here" }
64 std::isupper(make_str
<wchar_t, 2>(), loc
); // { dg-error "required from here" }
65 std::islower(make_str
<wchar_t, 3>(), loc
); // { dg-error "required from here" }
66 std::isalpha(make_str
<wchar_t, 4>(), loc
); // { dg-error "required from here" }
67 std::isdigit(make_str
<wchar_t, 5>(), loc
); // { dg-error "required from here" }
68 std::ispunct(make_str
<wchar_t, 6>(), loc
); // { dg-error "required from here" }
69 std::isxdigit(make_str
<wchar_t, 7>(), loc
); // { dg-error "required from here" }
70 std::isalnum(make_str
<wchar_t, 8>(), loc
); // { dg-error "required from here" }
71 std::isgraph(make_str
<wchar_t, 9>(), loc
); // { dg-error "required from here" }
72 #if __cplusplus >= 201103
73 std::isblank(make_str
<wchar_t, 10>(), loc
); // { dg-error "required from here" "" { target c++11 } }
75 std::toupper(make_str
<wchar_t, 11>(), loc
); // { dg-error "required from here" }
76 std::tolower(make_str
<wchar_t, 12>(), loc
); // { dg-error "required from here" }