https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65592
Bug ID: 65592
Summary: internal compiler error: Segmentation fault when using
non-existant enum class enumerator
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tim.pavlic at minelab dot com.au
Source to reproduce:
----
struct Foo
{
enum class Bar
{
BAZ
};
};
void take_bar(Foo::Bar /*bar*/)
{
}
int main()
{
Foo f;
f.Bar::NON_EXISTANT_ENUMERATOR;
take_bar(f.Bar::NON_EXISTANT_ENUMERATOR);
}
----
I have the above source in a single file, ice.cpp, and compile with: g++
-std=c++11 ice.cpp
Don't know if it should, but the line f.Bar::NON_EXISTANT_ENUMERATOR is
ignored.
The call to take_bar(f.Bar::NON_EXISTANT_ENUMERATOR) is what causes the ICE.
The problem also exists in 4.8.2