This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
V3 PATCH: Correct type-name usage in basic_string.tcc
- To: gcc-patches at gcc dot gnu dot org
- Subject: V3 PATCH: Correct type-name usage in basic_string.tcc
- From: Gabriel Dos Reis <gdr at codesourcery dot com>
- Date: 15 Mar 2001 10:01:28 +0100
- Cc: libstdc++ at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
I caught this while compiling the library with -ansi -pedantic.
Maybe we might want to add those flags one day.
The build failed with
/BASE/dosreis/egcs/libstdc++-v3/include/bits/basic_string.h: In function
`std::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const
std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits =
std::char_traits<char>, _Alloc = std::allocator<char>]':
/BASE/dosreis/egcs/libstdc++-v3/src/string-inst.cc:51: instantiated from here
/BASE/dosreis/egcs/libstdc++-v3/include/bits/basic_string.h:552: invalid use of
member `std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::size_type'
Bootstrapped and tested on solaris-2.7, no regression. Installed on
both mainline and branch.
-- Gaby
CodeSourcery, LLC http://www.codesourcery.com
2001-03-15 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
* include/bits/basic_string.tcc (operator+): Fix thinko.
Index: include/bits/basic_string.tcc
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/basic_string.tcc,v
retrieving revision 1.3
diff -p -r1.3 basic_string.tcc
*** basic_string.tcc 2001/02/16 00:42:19 1.3
--- basic_string.tcc 2001/03/15 08:45:20
*************** namespace std
*** 549,555 ****
__string_type __str;
__size_type __len = __rhs.size();
__str.reserve(__len + 1);
! __str.append(__string_type::size_type(1), __lhs);
__str.append(__rhs);
return __str;
}
--- 549,555 ----
__string_type __str;
__size_type __len = __rhs.size();
__str.reserve(__len + 1);
! __str.append(__size_type(1), __lhs);
__str.append(__rhs);
return __str;
}