This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
egcs-1.0.2 bogus warning from fill_n()
- To: egcs-bugs at cygnus dot com
- Subject: egcs-1.0.2 bogus warning from fill_n()
- From: "Munagala V. S. Ramanath" <ram at netcom dot com>
- Date: Thu, 4 Jun 1998 11:52:56 -0700 (PDT)
Hi,
The following program produces what seems like a bogus warning:
/d2a/exper/include/g++/stl_algobase.h: In function `struct A ** fill_n<A **, int, int>(struct A **, int, const int &)':
/d2a/exper/include/g++/stl_algobase.h:293: warning: assignment to `A *' from `int' lacks a cast
Not sure what the standard says about this but it seems inconsistent
that direct assignment of 0 on line 8 is deemed ok but assignment of
0 via fill_n() on line 9 needs a cast.
My environment is SunOS 4.1.2:
g++ -v
Reading specs from /d2a/exper/lib/gcc-lib/sparc-sun-sunos4.1.2/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
Ram
-------- CUT HERE --------------------------------- CUT HERE -----------
// egcs complains about needing a cast
#include <stl.h>
struct A {};
main()
{
A *a[ 10 ] ;
a[ 0 ] = 0 ; // ok
fill_n( a, 10, 0 ) ; // warning about needing cast
return 0;
}
-------- CUT HERE --------------------------------- CUT HERE -----------