From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24365 invoked by alias); 10 Nov 2002 21:16:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 24348 invoked by uid 71); 10 Nov 2002 21:16:01 -0000 Date: Sun, 10 Nov 2002 13:16:00 -0000 Message-ID: <20021110211601.24347.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Wolfgang Bangerth Subject: Re: c++/1056: spurious warning on implicit conversion followed by promotion and comparison Reply-To: Wolfgang Bangerth X-SW-Source: 2002-11/txt/msg00492.txt.bz2 List-Id: The following reply was made to PR c++/1056; it has been noted by GNATS. From: Wolfgang Bangerth To: gcc-bugs@gcc.gnu.org, Cc: Subject: Re: c++/1056: spurious warning on implicit conversion followed by promotion and comparison Date: Sun, 10 Nov 2002 15:16:47 -0600 (CST) This report is about this code: --------------------------------------- struct X { operator unsigned short () const; }; int main() { X s; unsigned long l; if (l == s); if (s == l); return 0; } ------------------------------ and the following warnings: tmp/g> /home/bangerth/bin/gcc-3.3x-pre/bin/gcc -W -Wall -c x.cc x.cc: In function `int main()': x.cc:9: warning: comparison between signed and unsigned integer expressions x.cc:10: warning: comparison between signed and unsigned integer expressions I had initially thought that this may be due to argument promotion to a signed type from the unsigned short the conversion operator returns, but then the same should happen when we define "s" as an unsigned short right from the start. However, this makes the warning go away. So I don't know... W. ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ticam.utexas.edu www: http://www.ticam.utexas.edu/~bangerth