[Bug c++/67047] New: GCC accepts ill-formed program with enumerator not representable in uintmax_t
anders.granlund.0 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jul 29 00:07:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67047
Bug ID: 67047
Summary: GCC accepts ill-formed program with enumerator not
representable in uintmax_t
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: anders.granlund.0 at gmail dot com
Target Milestone: ---
Consider the following program (prog.cc):
#include <cstdint>
#include <limits>
enum { x = std::numeric_limits<std::uintmax_t>::max(), y };
int main() {}
Compile it with the following command line:
g++ prog.cc -std=c++14 -pedantic-errors
No error messages are given. The program is ill-formed by the last sentence of
the third list item of [dcl.enum]p5 (http://eel.is/c++draft/dcl.enum#5) so at
least one error message was expected.
I have tried this with gcc HEAD 6.0.0 20150728 here:
http://melpon.org/wandbox/permlink/8EVR4wM7TqLBTrVG
More information about the Gcc-bugs
mailing list