https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69972
Bug ID: 69972 Summary: duplicate integer overflow diagnostic in constant expressions Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- Both the C and the C++ front ends issue duplicate diagnostics for integer overflows in constant expressions. For example, in C: $ /home/msebor/build/gcc-4.9.3/gcc/xgcc -B/home/msebor/build/gcc-4.9.3/gcc -S -Wall -Wextra -Wpedantic -o/dev/null -xc x.c x.c:1:24: warning: integer overflow in expression [-Woverflow] enum { e = __INT_MAX__ + 1 }; ^ x.c:1:8: warning: overflow in constant expression [-Woverflow] enum { e = __INT_MAX__ + 1 }; ^ G++ issues two similar kinds of diagnostics for the following code, one -Woverflow and another -fpermissive: $ cat t.c && /build/gcc-trunk/gcc/xgcc -B /build/gcc-trunk/gcc -S -Wall -Wextra -Wpedantic -o/dev/null -xc++ t.c template <int N> struct S { }; S<(__INT_MAX__ + 1)> s; t.c:2:16: warning: integer overflow in expression [-Woverflow] S<(__INT_MAX__ + 1)> s; ~~~~~~~~~~~~^~~ t.c:2:20: error: overflow in constant expression [-fpermissive] S<(__INT_MAX__ + 1)> s; ^ t.c:2:20: note: in template argument for type ‘int’