[Bug c++/69138] Woverflow not triggered for constexpr within template class
ryxi at stu dot xidian.edu.cn
gcc-bugzilla@gcc.gnu.org
Sun Mar 12 10:39:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69138
--- Comment #4 from Xi Ruoyao <ryxi at stu dot xidian.edu.cn> ---
Created attachment 40950
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40950&action=edit
Another way to show this bug
This test case also exploits this bug.
In this lim<long> should be the same as limlong, but g++ (trunk) only
warns about the latter:
~~~
pr69138-2.cpp: In function 'long unsigned int limlong(bool)':
pr69138-2.cpp:23:16: warning: integer overflow in expression [-Woverflow]
return b ? -limits<long>::min : limits<long>::max;
~~~
No warnings generated for lim<long>(bool).
More information about the Gcc-bugs
mailing list