On Tue, Jan 12, 2016 at 01:52:01PM +0100, Marek Polacek wrote: > --- gcc/testsuite/g++.dg/warn/permissive-1.C > +++ gcc/testsuite/g++.dg/warn/permissive-1.C > @@ -0,0 +1,8 @@ > +// PR c++/68979 > +// { dg-do compile } > +// { dg-options "-fpermissive -Wno-shift-overflow -Wno-shift-count-overflow > -Wno-shift-count-negative" } > + > +enum A { AA = -1 << 4 }; // { dg-warning "operand of shift expression" "" { > target c++11 } } > +enum B { BB = 1 << -4 }; // { dg-warning "operand of shift expression" } > +enum C { CC = 1 << 100 }; // { dg-warning "operand of shift expression" } > +enum D { DD = 31 << 30 }; // { dg-warning "shift expression" "" { target > c++11 } }
Shouldn't this test be limited to // { dg-do compile { target int32 } } or better yet replace the 100 and 30 above with say __SIZEOF_INT__ * 4 * __CHAR_BIT__ - 4 and __SIZEOF_INT__ * __CHAR_BIT__ - 2 ? I'd guess that on say int16 targets, or int64 targets (if we have any at some point) or int128 targets this wouldn't do what you are expecting. { target int32 } is not exactly right, because it still assumes __CHAR_BIT__ == 8 and for other char sizes it could fail. Jakub