Red Hat Bugzilla – Bug 997153
g++ 4.4 compiler segv on static_cast inside enum declaration
Last modified: 2015-05-15 07:29:21 EDT
Created attachment 786670 [details]
Diagnostic output file from g++ compiler when segv occurred (includes offending source code)
Description of problem:
When attempting to perform a static_cast<Foo>(-1) within the declaration of enum Foo, the compiler incurs a segv
Version-Release number of selected component (if applicable):
Compiler version: g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
OS version: CentOS 6.3 (kernel 2.6.32-279.el6.i686)
VMware version: VMware Player 5.0.1 build-894247
Hardware version: x86-64 (Dell Optiplex 7010, Intel Core i7-3770 @ 3.4 Ghz)
Steps to Reproduce:
Extract the source code in the attached file and put in a file named, e.g. bugrepro.cpp and compile with the following command at the Linux shell:
g++ -o bugrepro bugrepro.cpp
g++ compiler outputs the following messages:
"Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccCP2119.out file, please attach this to your bugreport."
Compiles without error, or generates an error message on the console indicating
a static_cast<> with the same data type as the enclosing declaration is illegal.
See attached file.
This was fixed by r206716:
2014-01-17 Marek Polacek <email@example.com>
* cvt.c (ocp_convert): Don't segfault on non-existing
The patch is trivial (but can't be applied cleanly), but the code is invalid.