This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

(C++) Incorrect new warning?


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/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]