This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
(C++) Incorrect new warning?
- To: gcc-bugs at gcc dot gnu dot org, Nathan Sidwell <nathan at codesourcery dot com>
- Subject: (C++) Incorrect new warning?
- From: Gerald Pfeifer <pfeifer at dbai dot tuwien dot ac dot at>
- Date: Mon, 6 Mar 2000 15:33:58 +0100 (MET)
Today I started seeing the following new error message
x.cc: In function `int main ()':
x.cc:8: warning: passing negative value `-1' for argument 1 of
x.cc:8: warning: `pair<_T1, _T2>::pair (const _T1 &, const _T2 &) [with
x.cc:8: warning: _T1 = int, _T2 = unsigned char]'
for code like the following:
#include <vector>
typedef pair<int,unsigned char> CHANGE;
main() {
vector<CHANGE> stack;
stack.push_back( CHANGE(-1,0) );
}
Argument 1 of CHANGE is a (signed) integer, so I don't see why the
compiler should issue a warning when seeing -1.
According to `cvs annotate` it seems this was introduced by
2000-03-05 Nathan Sidwell <nathan@codesourcery.com>
* call.c (convert_like): Macrofy.
(convert_like_with_context): New macro.
(convert_like_real): Renamed from convert_like. Add calling
context parameters, for diagnostics. Add recursive flag. Call
dubious_conversion_warnings for outer conversion.
:
Gerald
--
Gerald "Jerry" pfeifer@dbai.tuwien.ac.at http://www.dbai.tuwien.ac.at/~pfeifer/