I have a method requiring several variables of the same enum type. To allow the compiler to detect if I pass the wrong argument I am using BOOST_STRONG_TYPEDEF. However, I get a seg fault when I create an instance and compare within an IF statement.
Boost version is 1.74
enum class Testable
{
UNDEFINED,
A,
B
};
BOOST_STRONG_TYPEDEF(Testable, SomeType)
int main()
{
SomeType abc{Testable::UNDEFINED};
std::cout << "START" << std::endl;
if(abc == Testable::UNDEFINED) // Seg faults here
{
volatile int j = 0;
}
std::cout << "FINISH" << std::endl;
}
GDB backtrace suggests it's a stack overflow/recursive calling:
#1 0x00007ffff74c5d9d in boost::operators_impl::operator== (y=@0x7fffffcc9e44:
#2 0x00007ffff74c5d9d in boost::operators_impl::operator== (y=@0x7fffffcc9e44:
#3 0x00007ffff74c5d9d in boost::operators_impl::operator== (y=@0x7fffffcc9e44:
#4 0x00007ffff74c5d9d in boost::operators_impl::operator== (y=@0x7fffffcc9e44:
#5 0x00007ffff74c5d9d in boost::operators_impl::operator== (y=@0x7fffffcc9e44:
#6 0x00007ffff74c5d9d in boost::operators_impl::operator== (y=@0x7fffffcc9e44:
There's not much documentation for BOOST_STRONG_TYPEDEF. Am I using it wrong?
Boost version is 1.74. I'm using Clang.