[cfe-dev] Problems with modern versions of libstdc++

Christopher Jefferson chris at bubblescope.net
Wed Feb 17 05:40:33 PST 2010

I have been using clang++ to compile some code, and have been finding problems arising from which version of g++ is installed as the system compiler. I was wondering what the policy is on fixing bugs and keeping this working:

Using g++ 4.2 as the system compiler, the following works fine:

#include <tr1/array>
#include <ostream>

int main(void) {}

Once I update to g++ 4.4, #include <tr1/array> breaks, as g++ switches to using variadic templates even in TR1.

More worryingly, once I upgrade to a current svn version of g++ 4.5, <ios> (and therefore most files involving streams, including ostream/istream/fstream) fails to compile due to the following code in locale_facets.h

template<typename _Tv>
   __convert_to_v(const char* __in, _Tv& __out, ios_base::iostate& __err,
    const __c_locale& __cloc);

   __convert_to_v(const char*, float&, ios_base::iostate&,
    const __c_locale&) throw();

Which fails to compile with the error:

/gccsvn/lib/gcc/x86_64-apple-darwin10.2.0/4.5.0/../../../../include/c++/4.5.0/bits/locale_facets.h:71:5: error: 
     exception specification in declaration does not match previous declaration
   __convert_to_v(const char*, float&, ios_base::iostate&,
/gccsvn/lib/gcc/x86_64-apple-darwin10.2.0/4.5.0/../../../../include/c++/4.5.0/bits/locale_facets.h:65:5: note: 
     previous declaration is here
   __convert_to_v(const char* __in, _Tv& __out, ios_base::iostate& __err,

Should such bugs be reported up-stream? Would clang add support for such g++-specific code, if it was not fixed upstream?

Sorry for the slightly vague question,

Thanks, Chris

More information about the cfe-dev mailing list