Starting with the C++ delayed folding merge, we reject this test with -fwrapv: struct C { static const unsigned short max = static_cast<unsigned short>((32767 * 2 + 1)); }; q.C:2:80: error: overflow in constant expression [-fpermissive] static const unsigned short max = static_cast<unsigned short>((32767 * 2 + 1)); ^ q.C:2:80: error: overflow in constant expression [-fpermissive] q.C:2:80: error: overflow in constant expression [-fpermissive] q.C:2:80: error: overflow in constant expression [-fpermissive]
Author: jason Date: Mon Feb 8 15:31:47 2016 New Revision: 233216 URL: https://gcc.gnu.org/viewcvs?rev=233216&root=gcc&view=rev Log: PR c++/69631 gcc/ * convert.c (convert_to_integer_1): Check dofold on truncation distribution. (convert_to_pointer_maybe_fold, convert_to_real_maybe_fold) (convert_to_integer_maybe_fold, convert_to_complex_maybe_fold): Rename from *_nofold. * convert.h (convert_to_pointer_nofold, convert_to_integer_nofold) (convert_to_real_nofold, convert_to_complex_nofold): New inlines. gcc/cp/ * cp-tree.h (CONV_FOLD, CONV_BACKEND_CONVERT): New. * cvt.c (convert): Pass CONV_BACKEND_CONVERT. (ocp_convert): Use *_maybe_fold. (cp_convert_to_pointer): Add dofold parameter. * cp-gimplify.c (cp_fold) [CONVERT_EXPR]: Call convert. Added: trunk/gcc/testsuite/g++.dg/delayedfold/fwrapv1.C Modified: trunk/gcc/ChangeLog trunk/gcc/convert.c trunk/gcc/convert.h trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-gimplify.c trunk/gcc/cp/cp-tree.h trunk/gcc/cp/cvt.c
Fixed.