diff options
author | Paolo Carlini <pcarlini@suse.de> | 2004-03-03 00:22:05 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2004-03-03 00:22:05 +0000 |
commit | 0b1d67d23b3498243272f751414b157054be4515 (patch) | |
tree | facba5f352496caa2ec5d778e2625a680ec40fc6 /libstdc++-v3/testsuite/27_io/fpos | |
parent | 0eadce5226808dfd6180effb4de3ad794d72c84d (diff) | |
download | gcc-0b1d67d23b3498243272f751414b157054be4515.tar.gz |
re PR libstdc++/14320 (istreambuf_iterator::difference_type is not a signed integral type)
2004-03-02 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/14320
* include/bits/postypes.h (class streamoff): Remove, now
streamoff is just typedef a 64 bit signed integer type.
(class fpos): Tweak consistently.
* testsuite/27_io/fpos/14320-1.cc: New.
* testsuite/27_io/fpos/14320-2.cc: New.
* testsuite/27_io/fpos/14320-3.cc: New.
* testsuite/27_io/fpos/14320-4.cc: New.
* testsuite/27_io/fpos/14320-5.cc: New.
* testsuite/27_io/fpos/mbstate_t/4_neg.cc: xfail for now.
From-SVN: r78799
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/fpos')
-rw-r--r-- | libstdc++-v3/testsuite/27_io/fpos/14320-1.cc | 61 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/27_io/fpos/14320-2.cc | 44 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/27_io/fpos/14320-3.cc | 43 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/27_io/fpos/14320-4.cc | 52 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/27_io/fpos/14320-5.cc | 45 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc | 4 |
6 files changed, 247 insertions, 2 deletions
diff --git a/libstdc++-v3/testsuite/27_io/fpos/14320-1.cc b/libstdc++-v3/testsuite/27_io/fpos/14320-1.cc new file mode 100644 index 00000000000..71a4d7a5c20 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/fpos/14320-1.cc @@ -0,0 +1,61 @@ +// 2004-03-02 Petur Runolfsson <peturr02@ru.is> + +// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 27.4.3 fpos + +// { dg-do run { xfail *-*-* } } + +#include <typeinfo> +#include <limits> +#include <iterator> +#include <testsuite_hooks.h> + +// libstdc++/14320 +void test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + typedef istreambuf_iterator<char>::difference_type Distance; + + bool found = false; + if (typeid(Distance) == typeid(long int)) + found = true; + if (typeid(Distance) == typeid(int)) + found = true; + if (typeid(Distance) == typeid(short int)) + found = true; + if (typeid(Distance) == typeid(signed char)) + found = true; + if (numeric_limits<char>::is_signed && + typeid(Distance) == typeid(char)) + found = true; + if (numeric_limits<wchar_t>::is_signed && + typeid(Distance) == typeid(wchar_t)) + found = true; + + VERIFY( found ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/27_io/fpos/14320-2.cc b/libstdc++-v3/testsuite/27_io/fpos/14320-2.cc new file mode 100644 index 00000000000..a60daf94c15 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/fpos/14320-2.cc @@ -0,0 +1,44 @@ +// 2004-03-02 Petur Runolfsson <peturr02@ru.is> + +// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 27.4.3 fpos + +// { dg-do run { xfail *-*-* } } + +#include <iterator> +#include <limits> +#include <testsuite_hooks.h> + +void test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + typedef istreambuf_iterator<char>::difference_type Distance; + typedef numeric_limits<Distance> Limits; + + VERIFY( Limits::is_specialized ); + VERIFY( Limits::is_signed ); +} + +int main() +{ + test01(); +} diff --git a/libstdc++-v3/testsuite/27_io/fpos/14320-3.cc b/libstdc++-v3/testsuite/27_io/fpos/14320-3.cc new file mode 100644 index 00000000000..19c839e2f74 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/fpos/14320-3.cc @@ -0,0 +1,43 @@ +// 2004-03-02 Petur Runolfsson <peturr02@ru.is> + +// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 27.4.3 fpos + +#include <iterator> +#include <testsuite_hooks.h> + +// libstdc++/14320 +int test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + typedef std::istreambuf_iterator<char>::difference_type Distance; + Distance d = 2; + Distance e = 3; + d *= e; + VERIFY( static_cast<int>(d) == 6 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/27_io/fpos/14320-4.cc b/libstdc++-v3/testsuite/27_io/fpos/14320-4.cc new file mode 100644 index 00000000000..591bb4f7a69 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/fpos/14320-4.cc @@ -0,0 +1,52 @@ +// 2004-03-02 Petur Runolfsson <peturr02@ru.is> + +// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 27.4.3 fpos + +#include <iterator> +#include <testsuite_hooks.h> + +class Fred +{ +public: + Fred(bool) + { } +}; + +void barney(Fred) +{ } + +// libstdc++/14320 +void test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + typedef istreambuf_iterator<char>::difference_type Distance; + + Distance d = 0; + barney(d); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/27_io/fpos/14320-5.cc b/libstdc++-v3/testsuite/27_io/fpos/14320-5.cc new file mode 100644 index 00000000000..7c15620e345 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/fpos/14320-5.cc @@ -0,0 +1,45 @@ +// 2004-03-02 Petur Runolfsson <peturr02@ru.is> + +// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 27.4.3 fpos + +#include <iterator> +#include <sstream> +#include <testsuite_hooks.h> + +// libstdc++/14320 +void test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + typedef istreambuf_iterator<char>::difference_type Distance; + + Distance d; + istringstream in("5"); + in >> d; + VERIFY( d == 5 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc index ace81eb2669..0db4772acd7 100644 --- a/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc +++ b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc @@ -29,10 +29,10 @@ void test04() long n; // Implicit conversion - n = pos; // { dg-error "cannot convert" } + n = pos; // { dg-error "cannot convert" "" { xfail *-*-* } } // Explicit conversion - n = static_cast<long>(pos); // { dg-error "invalid static_cast" } + n = static_cast<long>(pos); // { dg-error "invalid static_cast" "" { xfail *-*-* } } } int main() |