On 12/23/20 4:43 PM, Jakub Jelinek wrote:
On Wed, Dec 23, 2020 at 04:40:29PM -0500, Jason Merrill via Gcc-patches wrote:
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow3.C
b/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow3.C
new file mode 100644
index 00000000000..22d4c59f4f8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow3.C
@@ -0,0 +1,5 @@
+// PR c++/98332
+// { dg-do compile { target c++11 } }
+
+struct S { int a = 2147483647 + 1; }; // { dg-warning "overflow" }
Wouldn't it be more portable to use __INT_MAX__ + 1 here, so that it
will work also on 16-bit int targets?
Good point, fixed.
Jason