Open
Description
The parser seems to fail on
struct a {
constexpr operator int() { return 3; }
};
I modified Parser::rOtherDeclaration to look for ID_operator recursively
if(is_constructor)
{
#ifdef DEBUG
std::cout << std::string(__indent, ' ') << "Parser::rOtherDeclaration 4\n";
#endif
assert(!type_name.get_sub().empty());
std::function<bool(typet&)> is_operator_recurse = [&](typet& t) {
for(unsigned i=0; i < t.get_sub().size(); i++)
{
irept& sub = t.get_sub()[i];
if(sub.id() == ID_operator)
return true;
}
if(t.id() == ID_merged_type)
for (auto& st: t.subtypes())
if (is_operator_recurse(st))
return true;
return false;
};
is_operator = is_operator_recurse(type_name);
}
but that just moves the crash to a later phase (cpp_typecheckt::typecheck_compound_declarator)