#1278 closed Bugs (fixed)
declaration of 'str' shadows a member of 'this'
Reported by: | Owned by: | Samuel Krempp | |
---|---|---|---|
Milestone: | Boost 1.35.0 | Component: | format |
Version: | Boost 1.34.1 | Severity: | Problem |
Keywords: | Cc: | esigra@… |
Description
When using boost::format
and compiling with G++ with the -Wshadow
option enabled, the following warning is generated:
/usr/include/boost/format/format_implementation.hpp:28: warning: declaration of 'str' shadows a member of 'this'
The relevant lines of code are:
template< class Ch, class Tr, class Alloc> basic_format<Ch, Tr, Alloc>:: basic_format(const Ch* str) : style_(0), cur_arg_(0), num_args_(0), dumped_(false), exceptions_(io::all_error_bits) { if( str) parse( str ); } #if !defined(BOOST_NO_STD_LOCALE) template< class Ch, class Tr, class Alloc> basic_format<Ch, Tr, Alloc>:: basic_format(const Ch* str, const std::locale & loc) : style_(0), cur_arg_(0), num_args_(0), dumped_(false), loc_(loc), exceptions_(io::all_error_bits) { if(str) parse( str ); }
This problem would be easily fixed by changing the local variable str
to s
-- as is already the case in the next function:
template< class Ch, class Tr, class Alloc> basic_format<Ch, Tr, Alloc>:: basic_format(const string_type& s, const std::locale & loc) : style_(0), cur_arg_(0), num_args_(0), dumped_(false), loc_(loc), exceptions_(io::all_error_bits) { parse(s); }
Change History (2)
comment:1 by , 15 years ago
Milestone: | To Be Determined → Boost 1.35.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:2 by , 14 years ago
Cc: | added |
---|
Note:
See TracTickets
for help on using tickets.
Fixed in SVN Trunk.