2 // { dg-options "-Wsign-conversion" }
4 // Copyright (C) 1999 Free Software Foundation, Inc.
5 // Contributed by Nathan Sidwell 21 Nov 1999 <nathan@acm.org>
7 // make sure we only warn on assigning a negative (signed) value
8 // to an unsigned type, and don't warn just if the unsigned value
9 // happens to have the top bit set.
19 unsigned volatile s3 = -1u;
20 unsigned const s4 = -1u;
21 unsigned const &s5(-1u);
39 unsigned s1 = -1; // { dg-warning "" } initialization
40 unsigned s2(-1); // { dg-warning "" } initialization
41 unsigned volatile s3 = -1;// { dg-warning "" } initialization
42 unsigned const s4 = -1; // { dg-warning "" } initialization
43 unsigned const &s5(-1); // { dg-warning "" } initialization
44 s1 = -1; // { dg-warning "" } assignment
45 fn (-1); // { dg-warning "" } passing
52 unsigned volatile s3 = -(-1);
53 unsigned const s4 = -(-1);
54 unsigned const &s5(-(-1));
63 unsigned volatile s3 = -0;
64 unsigned const s4 = -0;
65 unsigned const &s5(-0);