]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/21_strings/c_strings/char/3_neg.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 21_strings / c_strings / char / 3_neg.cc
CommitLineData
43014633
JJ
1// { dg-do compile { target correct_iso_cpp_string_wchar_protos } }
2// { dg-options "-O2" }
3
818ab71a 4// Copyright (C) 2009-2016 Free Software Foundation, Inc.
8207d787
BK
5//
6// This file is part of the GNU ISO C++ Library. This library is free
7// software; you can redistribute it and/or modify it under the
8// terms of the GNU General Public License as published by the
9// Free Software Foundation; either version 3, or (at your option)
10// any later version.
11
12// This library is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16
17// You should have received a copy of the GNU General Public License along
18// with this library; see the file COPYING3. If not see
19// <http://www.gnu.org/licenses/>.
20
43014633
JJ
21#include <cstring>
22
23const char *cc1, *cc2;
24char *c1, *c2;
25const void *cv1, *cv2;
26void *v1, *v2;
27
28void
29test01 ()
30{
31 v1 = std::memchr (v2, '/', 3);
32 c1 = std::strchr (c2, '/');
33 c1 = std::strrchr (c2, 'c');
34 c1 = std::strpbrk (c2, "abc");
35 c1 = std::strstr (c2, "abc");
36
37 cv1 = std::memchr (v2, '/', 3);
38 cc1 = std::strchr (c2, '/');
39 cc1 = std::strrchr (c2, 'c');
40 cc1 = std::strpbrk (c2, "abc");
41 cc1 = std::strstr (c2, "abc");
42
43 v1 = std::memchr (cv2, '/', 3); // { dg-error "invalid conversion" }
44 c1 = std::strchr (cc2, '/'); // { dg-error "invalid conversion" }
45 c1 = std::strrchr (cc2, 'c'); // { dg-error "invalid conversion" }
46 c1 = std::strpbrk (cc2, "abc"); // { dg-error "invalid conversion" }
47 c1 = std::strstr (cc2, "abc"); // { dg-error "invalid conversion" }
48
49 cv1 = std::memchr (cv2, '/', 3);
50 cc1 = std::strchr (cc2, '/');
51 cc1 = std::strrchr (cc2, 'c');
52 cc1 = std::strpbrk (cc2, "abc");
53 cc1 = std::strstr (cc2, "abc");
54}