Hello!
When I compile some code under Linux I do not get errors which I have
under opensolaris. For example,
#include<string>
template<typename _C> struct string_conv_impl;
template<typename _D, typename _S>
inline std::basic_string<_D> string_conv(std::basic_string<_S> const& src)
{
return string_conv_impl<_D>::do_conv(src.c_str());
}
int main(){}
opensolaris alek/tmp> g++ cpp.cpp
cpp.cpp:4: error: expected nested-name-specifier before numeric constant
cpp.cpp:4: error: ISO C++ forbids declaration of `parameter' with no type
cpp.cpp:4: error: expected `>' before numeric constant
cpp.cpp:5: error: type/value mismatch at argument 1 in template
parameter list for `template<class _CharT, class _Traits, class
_Alloc> class std::basic_string'
cpp.cpp:5: error: expected a type, got `8'
cpp.cpp:5: error: template argument 2 is invalid
cpp.cpp:5: error: template argument 3 is invalid
cpp.cpp:6: error: ISO C++ forbids declaration of `src' with no type
cpp.cpp: In function `std::basic_string<_D, std::char_traits<_CharT>,
std::allocator<_CharT> > string_conv(int&)':
cpp.cpp:7: error: request for member `c_str' in `src', which is of
non-class type `int'
bubser alek/work> uname -a
Linux bubser 2.6.22.5-31-default #1 SMP 2007/09/21 22:29:00 UTC i686
i686 i386 GNU/Linux
bubser alek/work> g++ cpp.cpp
bubser alek/work> echo $?
0
what is wrong? what I shoud do to compile that cpp file under opensolaris?
Thanks in advance.
--
/BR, Alexander