X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=libstdc%2B%2B-v3%2Ftestsuite%2F22_locale%2Fctype%2Fis%2Fchar%2F9858.cc;fp=libstdc%2B%2B-v3%2Ftestsuite%2F22_locale%2Fctype%2Fis%2Fchar%2F9858.cc;h=7da75cbf62b69b06881f919c441380b8eda1081d;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=0000000000000000000000000000000000000000;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/char/9858.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/char/9858.cc
new file mode 100644
index 00000000..7da75cbf
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype/is/char/9858.cc
@@ -0,0 +1,94 @@
+// Copyright (C) 2003, 2009 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
+// .
+
+
+// 22.2.1.3 - ctype specializations [lib.facet.ctype.special]
+
+#include
+#include
+
+int called;
+
+class Derived : public std::ctype
+{
+public:
+ bool
+ do_is(mask, char_type) const { return true; }
+
+ const char_type*
+ do_is(const char_type*, const char_type* hi, mask*) const
+ { return hi; }
+
+ const char_type*
+ do_scan_is(mask, const char_type*, const char_type* hi) const
+ { return hi; }
+
+ const char_type*
+ do_scan_not(mask, const char_type*, const char_type* hi) const
+ { return hi; }
+};
+
+class Derived2 : public Derived
+{
+public:
+ bool
+ do_is(mask, char_type) const { called = 1; return true; }
+
+ const char_type*
+ do_is(const char_type*, const char_type* hi, mask*) const
+ { called = 5; return hi; }
+
+ const char_type*
+ do_scan_is(mask, const char_type*, const char_type* hi) const
+ { called = 10; return hi; }
+
+ const char_type*
+ do_scan_not(mask, const char_type*, const char_type* hi) const
+ { called = 15; return hi; }
+};
+
+int main()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+ Derived2 d2;
+ const Derived& dr = d2;
+
+ const char* lit = "jaylib champion sound";
+ ctype_base::mask m00 = static_cast(0);
+ ctype_base::mask vec[5];
+ for (std::size_t i = 0; i < 5; ++i)
+ vec[i] = m00;
+
+ called = 0;
+ dr.do_is(ctype_base::space, 'a');
+ VERIFY( called != 1);
+
+ called = 0;
+ dr.do_is(lit, lit + 5, vec);
+ VERIFY( called != 5);
+
+ called = 0;
+ dr.do_scan_is(ctype_base::space, lit, lit + 5);
+ VERIFY( called != 10);
+
+ called = 0;
+ dr.do_scan_not(ctype_base::space, lit, lit + 5);
+ VERIFY( called != 15);
+
+ return 0;
+}