fix StructLayout::getNumber

This commit is contained in:
MihailRis 2024-08-31 19:58:41 +03:00
parent 35079d1b49
commit dfb5baf79b
2 changed files with 4 additions and 1 deletions

View File

@ -310,7 +310,8 @@ number_t StructLayout::getNumber(
case FieldType::I64:
case FieldType::CHAR:
return getInteger(src, name, index);
default:
throw std::runtime_error("type error");
}
throw std::runtime_error("type error");
}

View File

@ -92,6 +92,8 @@ TEST(StructLayout, ConvertWithLoss) {
};
auto dstLayout = StructLayout::create(dstFields);
auto report = srcLayout.checkCompatibility(dstLayout);
// check report
std::sort(report.begin(), report.end(), [](const auto& a, const auto& b) {
return a.name < b.name;
});