This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
egcs-19980531: spurious <map.h> warning?
- To: egcs-bugs at cygnus dot com
- Subject: egcs-19980531: spurious <map.h> warning?
- From: "Theodore C. Belding" <Ted dot Belding at umich dot edu>
- Date: Thu, 4 Jun 1998 05:13:04 -0400
The egcs-19980531 snapshot gives the following warning when compiling the
map example program from the SGI STL 3.0 docs (see map.cc below) using
-Wall on hppa1.1-hp-hpux10.20. The program runs fine, but this warning
seems to occur whenever I use STL maps under egcs-19980531 and prevents me
from compiling with -Werror and -Wall. This problem does not occur with
egcs-1.0.3a. Please let me know if this is an STL bug rather than an egcs
bug. Thanks!
-Ted
fiore:~% eg++-19980531 -Wall map.cc
/s/users/streak/local/egcs-19980531/include/g++/stl_tree.h: In method
`rb_tree<c
onst char *,pair<const char *const,int>,select1st<pair<const char
*const,int> >,
ltstr,__default_alloc_template<false,0> >::rb_tree<const char *, pair<const
char
*const,int>, select1st<pair<const char *const,int> >, ltstr, alloc>(const
struc
t ltstr & = Compare())':
/s/users/streak/local/egcs-19980531/include/g++/stl_map.h:86:
instantiated fro
m `map<const char *,int,ltstr,__default_alloc_template<false,0>
>::map<const cha
r *, int, ltstr, alloc>()'
map.cc:14: instantiated from here
/s/users/streak/local/egcs-19980531/include/g++/stl_tree.h:524: warning:
stateme
nt with no effect
fiore:~%
map.cc:
--- cut here
#include <map.h>
#include <iostream.h>
struct ltstr
{
bool operator()(const char* s1, const char* s2) const
{
return strcmp(s1, s2) < 0;
}
};
int main()
{
map<const char*, int, ltstr> months;
months["january"] = 31;
months["february"] = 28;
months["march"] = 31;
months["april"] = 30;
months["may"] = 31;
months["june"] = 30;
months["july"] = 31;
months["august"] = 31;
months["september"] = 30;
months["october"] = 31;
months["november"] = 30;
months["december"] = 31;
cout << "june -> " << months["june"] << endl;
map<const char*, int, ltstr>::iterator cur = months.find("june");
map<const char*, int, ltstr>::iterator prev = cur;
map<const char*, int, ltstr>::iterator next = cur;
++next;
--prev;
cout << "Previous (in alphabetical order) is " << (*prev).first << endl;
cout << "Next (in alphabetical order) is " << (*next).first << endl;
}
--- cut here
--
Ted Belding Ted.Belding@umich.edu
University of Michigan Program for the Study of Complex Systems
http://www-personal.umich.edu/~streak/