[test] failure of basic_cstring_test with GNU libstdc++

Boost.Test library test basic_cstring_test.cpp fails to compile on many (all?) platforms using GNU libstdc++. Follows reproducer and the results of compiling it with GNU 4.3.0 and 3.4.6. Replacing 'utf::basic_cstring<CharT>::size_type' with 'std::size_t' in libs/test/test/basic_cstring_test.cpp makes the problem go away. Is it a known problem in GNU libstdc++? Does the fact that the implementation does not have to provide specializations of basic_string<> other than for 'char' and 'wchar_t' makes x.cpp below illegal? Thanks, Boris x.cpp ----- #include <string> template<typename T> void foo(T) { std::basic_string<T>::size_type i = 1; } bash-2.03$ g++ -dumpversion ; g++ -c x.cpp 4.3.0 x.cpp: In function 'void foo(T)': x.cpp:4: error: expected `;' before 'i' bash-2.03$ bash-3.00$ g++ -dumpversion ; g++ -c x.cpp 3.4.6 x.cpp: In function `void foo(T)': x.cpp:4: error: expected `;' before "i" bash-3.00$

Gubenko, Boris wrote:
Boost.Test library test basic_cstring_test.cpp fails to compile on many (all?) platforms using GNU libstdc++. Follows reproducer and the results of compiling it with GNU 4.3.0 and 3.4.6.
Replacing 'utf::basic_cstring<CharT>::size_type' with 'std::size_t' in libs/test/test/basic_cstring_test.cpp makes the problem go away.
Is it a known problem in GNU libstdc++? Does the fact that the implementation does not have to provide specializations of basic_string<> other than for 'char' and 'wchar_t' makes x.cpp below illegal?
Thanks, Boris
x.cpp ----- #include <string>
template<typename T> void foo(T) { std::basic_string<T>::size_type i = 1; }
Aren't you missing a 'typename' in the above ? template<typename T> void foo(T) { typename std::basic_string<T>::size_type i = 1; } should work. HTH, Stefan -- ...ich hab' noch einen Koffer in Berlin...

Stefan Seefeld wrote:
Aren't you missing a 'typename' in the above ?
Right. Thanks! In fact, it does not compile with EDG-based compilers in strict ansi mode also. Gennadiy, will you fix the test yourself or do you want a patch? Thanks, Boris
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Stefan Seefeld Sent: Friday, August 01, 2008 3:34 PM To: boost@lists.boost.org Subject: Re: [boost] [test] failure of basic_cstring_test with GNU libstdc++
Gubenko, Boris wrote:
Boost.Test library test basic_cstring_test.cpp fails to compile on many (all?) platforms using GNU libstdc++. Follows reproducer and the results of compiling it with GNU 4.3.0 and 3.4.6.
Replacing 'utf::basic_cstring<CharT>::size_type' with 'std::size_t' in libs/test/test/basic_cstring_test.cpp makes the problem go away.
Is it a known problem in GNU libstdc++? Does the fact that the implementation does not have to provide specializations of basic_string<> other than for 'char' and 'wchar_t' makes x.cpp below illegal?
Thanks, Boris
x.cpp ----- #include <string>
template<typename T> void foo(T) { std::basic_string<T>::size_type i = 1; }
Aren't you missing a 'typename' in the above ?
template<typename T> void foo(T) { typename std::basic_string<T>::size_type i = 1; }
should work.
HTH, Stefan
--
...ich hab' noch einen Koffer in Berlin...
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Gubenko, Boris <boris.gubenko <at> hp.com> writes:
Stefan Seefeld wrote:
Aren't you missing a 'typename' in the above ?
Right. Thanks! In fact, it does not compile with EDG-based compilers in strict
ansi mode also.
Gennadiy, will you fix the test yourself or do you want a patch?
Go ahead and fix it. You can post patch here. Gennadiy

Gennadiy Rozental wrote:
Go ahead and fix it. You can post patch here.
Attached is rather obvious patch, verified with GCC 4.3.0 and 3.4.6. Ok to commit? We can make 'typename utf::basic_cstring<CharT>::size_type' a macro, to reduce clutter, but since it was not a macro (without a 'typename', of course) in the original code, I did not do it. Thanks, Boris Index: test/basic_cstring_test.cpp =================================================================== --- test/basic_cstring_test.cpp (revision 47969) +++ test/basic_cstring_test.cpp (working copy) @@ -406,26 +406,26 @@ { utf::basic_cstring<CharT> bcs1( TEST_STRING ); - utf::basic_cstring<CharT>::size_type not_found = (utf::basic_cstring<CharT>::size_type)utf::basic_cstring<CharT>::npos; + typename utf::basic_cstring<CharT>::size_type not_found = (typename utf::basic_cstring<CharT>::size_type)utf::basic_cstring<Cha rT>::npos; BOOST_CHECK_EQUAL( bcs1.find( utf::basic_cstring<CharT>() ), not_found ); - BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "test" ) ), (utf::basic_cstring<CharT>::size_type)0 ); - BOOST_CHECK_EQUAL( bcs1.find( TEST_STRING ), (utf::basic_cstring<CharT>::size_type)0 ); + BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "test" ) ), (typename utf::basic_cstring<CharT>::size_type)0 ); + BOOST_CHECK_EQUAL( bcs1.find( TEST_STRING ), (typename utf::basic_cstring<CharT>::size_type)0 ); BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "test_string " ) ), not_found ); BOOST_CHECK_EQUAL( bcs1.find( LITERAL( " test_string" ) ), not_found ); - BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "est" ) ), (utf::basic_cstring<CharT>::size_type)1 ); - BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "t_st" ) ), (utf::basic_cstring<CharT>::size_type)3 ); - BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "ing" ) ), (utf::basic_cstring<CharT>::size_type)8 ); + BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "est" ) ), (typename utf::basic_cstring<CharT>::size_type)1 ); + BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "t_st" ) ), (typename utf::basic_cstring<CharT>::size_type)3 ); + BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "ing" ) ), (typename utf::basic_cstring<CharT>::size_type)8 ); BOOST_CHECK_EQUAL( bcs1.find( LITERAL( "tst" ) ), not_found ); BOOST_CHECK_EQUAL( bcs1.rfind( utf::basic_cstring<CharT>() ), not_found ); - BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "test" ) ), (utf::basic_cstring<CharT>::size_type)0 ); - BOOST_CHECK_EQUAL( bcs1.rfind( TEST_STRING ), (utf::basic_cstring<CharT>::size_type)0 ); + BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "test" ) ), (typename utf::basic_cstring<CharT>::size_type)0 ); + BOOST_CHECK_EQUAL( bcs1.rfind( TEST_STRING ), (typename utf::basic_cstring<CharT>::size_type)0 ); BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "test_string " ) ), not_found ); BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( " test_string" ) ), not_found ); - BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "est" ) ), (utf::basic_cstring<CharT>::size_type)1 ); - BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "t_st" ) ), (utf::basic_cstring<CharT>::size_type)3 ); - BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "ing" ) ), (utf::basic_cstring<CharT>::size_type)8 ); + BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "est" ) ), (typename utf::basic_cstring<CharT>::size_type)1 ); + BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "t_st" ) ), (typename utf::basic_cstring<CharT>::size_type)3 ); + BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "ing" ) ), (typename utf::basic_cstring<CharT>::size_type)8 ); BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "tst" ) ), not_found ); }
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Gennadiy Rozental Sent: Saturday, August 02, 2008 12:15 PM To: boost@lists.boost.org Subject: Re: [boost] [test] failure of basic_cstring_test with GNU libstdc++
Gubenko, Boris <boris.gubenko <at> hp.com> writes:
Stefan Seefeld wrote:
Aren't you missing a 'typename' in the above ?
Right. Thanks! In fact, it does not compile with EDG-based
compilers
in strict ansi mode also.
Gennadiy, will you fix the test yourself or do you want a patch?
Go ahead and fix it. You can post patch here.
Gennadiy
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Gubenko, Boris <boris.gubenko <at> hp.com> writes:
Gennadiy Rozental wrote:
Go ahead and fix it. You can post patch here.
Attached is rather obvious patch, verified with GCC 4.3.0 and 3.4.6.
Ok to commit?
We can make 'typename utf::basic_cstring<CharT>::size_type' a macro, to reduce
clutter, Can we make it a typedef?

Gennadiy Rozental wrote:
Can we make it a typedef?
Yes, we can :-) What name for this typedef do you want? size_type? (there is already 'typedef typename utf::basic_cstring<CharT>::traits_type traits_type;') Thanks, Boris
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Gennadiy Rozental Sent: Monday, August 04, 2008 6:29 PM To: boost@lists.boost.org Subject: Re: [boost] [test] failure of basic_cstring_test with GNU libstdc++
Gubenko, Boris <boris.gubenko <at> hp.com> writes:
Gennadiy Rozental wrote:
Go ahead and fix it. You can post patch here.
Attached is rather obvious patch, verified with GCC 4.3.0 and 3.4.6.
Ok to commit?
We can make 'typename utf::basic_cstring<CharT>::size_type'
a macro, to reduce clutter,
Can we make it a typedef?
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Done: http://svn.boost.org/trac/boost/changeset/47990 Thanks, Boris
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Gennadiy Rozental Sent: Monday, August 04, 2008 9:36 PM To: boost@lists.boost.org Subject: Re: [boost] [test] failure of basic_cstring_test with GNU libstdc++
Gubenko, Boris <boris.gubenko <at> hp.com> writes:
Gennadiy Rozental wrote:
Can we make it a typedef?
Yes, we can
What name for this typedef do you want? size_type? (there is already
Up 2 u.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (3)
-
Gennadiy Rozental
-
Gubenko, Boris
-
Stefan Seefeld