This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: libstdc++-2.90.6pre1 on ftp site


Benjamin Kosnik wrote:
> 
>As the name implies, this is close to what the next snapshot will
>contain,

I would like to point out a small problem with -fhonor-std
which should not make it into the release.
[This is in the cvs of 7.7.99 at least for a week]

The compilation fails with

c++ -DHAVE_CONFIG_H -I. -I/home/am/gcc/egcs_current/libstdc++/src -I.. -nostdinc++ -I/home/am/gcc/egcs_current/libstdc++ -I/home/am/gcc/egcs_current/libstdc++/stl
 -I/home/am/gcc/egcs_current/libstdc++/libio -fnew-abi -fhonor-std -O2 -g -D_GNU_SOURCE -fno-implicit-templates -fimplicit-templates -c  -fPIC -DPIC /home/am/gcc/
egcs_current/libstdc++/src/misc-inst.cc -o .libs/misc-inst.lo
/home/am/gcc/egcs_current/libstdc++/bits/istream.tcc: In method `std::basic_istream<char,std::char_traits<char> >::sentry::sentry(std::basic_istream<char,std::cha
r_traits<char> > &, bool = false)':
/home/am/gcc/egcs_current/libstdc++/bits/std_istream.h:107:   instantiated from `std::basic_istream<char,std::char_traits<char> >::operator >>(std::basic_istream<
char,std::char_traits<char> > & (*)(std::basic_istream<char,std::char_traits<char> > &))'
/home/am/gcc/egcs_current/libstdc++/src/misc-inst.cc:87:   instantiated from here
/home/am/gcc/egcs_current/libstdc++/bits/istream.tcc:56: no matching function for call to `isspace (int &)'
/home/am/gcc/egcs_current/libstdc++/bits/istream.tcc: In function `class std::basic_istream<char,std::char_traits<char> > & std::ws<char, std::char_traits<char> >
(std::basic_istream<char,std::char_traits<char> > &)':
/home/am/gcc/egcs_current/libstdc++/src/misc-inst.cc:88:   instantiated from here
/home/am/gcc/egcs_current/libstdc++/bits/istream.tcc:602: no matching function for call to `isspace (char &)'
/home/am/gcc/egcs_current/libstdc++/bits/istream.tcc: In method `std::basic_istream<__wchar_t,std::char_traits<__wchar_t> >::sentry::sentry(std::basic_istream<__w
char_t,std::char_traits<__wchar_t> > &, bool = false)':
/home/am/gcc/egcs_current/libstdc++/bits/std_istream.h:107:   instantiated from `std::basic_istream<__wchar_t,std::char_traits<__wchar_t> >::operator >>(std::basi
c_istream<__wchar_t,std::char_traits<__wchar_t> > & (*)(std::basic_istream<__wchar_t,std::char_traits<__wchar_t> > &))'
/home/am/gcc/egcs_current/libstdc++/src/misc-inst.cc:90:   instantiated from here
/home/am/gcc/egcs_current/libstdc++/bits/istream.tcc:56: no matching function for call to `isspace (wint_t &)'
/home/am/gcc/egcs_current/libstdc++/bits/istream.tcc: In function `class std::basic_istream<__wchar_t,std::char_traits<__wchar_t> > & std::ws<__wchar_t, std::char
_traits<__wchar_t> >(std::basic_istream<__wchar_t,std::char_traits<__wchar_t> > &)':
/home/am/gcc/egcs_current/libstdc++/src/misc-inst.cc:91:   instantiated from here
/home/am/gcc/egcs_current/libstdc++/bits/istream.tcc:602: no matching function for call to `isspace (__wchar_t &)'
make[2]: *** [misc-inst.lo] Error 1
make[2]: Leaving directory `/home/am/gcc/egcs_current/build/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/am/gcc/egcs_current/build'
make: *** [all-recursive-am] Error 2

or simply in bits/istream.tcc a proper isspace cannot be found in std.
(for me I "solved" it by replacing all three isspace by ::isspace).
bits/std_cctype.h only defines std::isspace(int) as it seems and hides all other isspace in global scope.
(same with other is... I guess).

From this and earlier problems it seems that not many are using -fhonor-std, that's too bad.
One day this will be standard.

As I am at it - the same with the testsuit.
I used a simple script to add a dump "using namespace std;" to all of them.
You might be interested that multiset.cc in fact will not compile.

ostream& operator<<(ostream& os, pair<int, int> const& p);
will not be found. All those std::operator<< come first... 
(see also C++ Standard Core Language Issues List item 102) 

You could solve it illegally by putting the operator into std or use something like

-----------------------
#include <iostream>
#include <set>
#include <algorithm>

using std::ostream;
using std::pair;
using std::multiset;
using std::ostream_iterator;
using std::cout;

struct pairwrapper{
  pairwrapper (int a,int b) :real(a,b) {}
  pair<int, int> real;
};

ostream& 
operator<<(ostream& os, pairwrapper const& p) 
{ return os << p.real.first << ' ' << p.real.second; }

bool 
operator<(pairwrapper const& lhs, pairwrapper const& rhs) 
{ return lhs.real.first < rhs.real.first; }

int main () 
{
  typedef multiset<pairwrapper>::iterator iterator;
  pairwrapper p(69, 0);
  multiset<pairwrapper> s;

  for (p.real.second = 0; p.real.second < 5; ++p.real.second)
    s.insert(p);
  for (iterator it = s.begin(); it != s.end(); ++it)
    if (it->real.second < 5) 
      {
	s.insert(it, p);
	++p.real.second;
      }

  // XXX need to use debug-assert here and get this working with an
  // ostrinsrtream, that way we can just check the strings for
  // equivalance.
  copy(s.begin(), s.end(), ostream_iterator<pairwrapper>(cout, "\n"));

  return 0;
}

-----------------------

Alfred

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]